我在我正在开发的服务器和客户端应用程序之间加密和解密数据时遇到了一些问题。我正在使用可以下载的脚本使用AES实现here at birth-online.de。Python上的AES实现,Windows
当我尝试在Ubuntu 10.04服务器上对数据进行编码或解码时,实现工作得很好。但是,试图利用Windows下的脚本时,我收到以下异常扔给我:
>>> aes.encrypt("Test", "Test", 256)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "aes.py", line 148, in encrypt
key = Cipher(pwBytes, KeyExpansion(pwBytes))
File "aes.py", line 112, in KeyExpansion
w = [0] * Nb*(Nr+1)
TypeError: can't multiply sequence by non-int of type 'float'
有谁知道这正是走错了,如何解决?我已经搜索了谷歌,但似乎无法找到任何有关此例外的有用信息。我在Windows(x64)测试机上使用Python 3.2.1,我的Ubuntu服务器运行Python 2.6.5。 (顺便说一句,这个版本可以改变它的性质吗?)
在此先感谢! Robert
Python 2.x和3.x之间有很大的区别。不管这是否是造成这种特殊差异的原因,我不知道,但我会说这是主要的嫌疑犯。 –
这似乎在Windows上的Python 2.7中起作用。我应该先测试一下..对我来说不是很聪明。但是,仍然应该可以在Python 3.x上运行它,因为2.7将会变得越来越老,没有新的发行版。 2.7是为2.x发布的最新版本。 – Robbietjuh
大多数软件包都必须针对python 3进行更新。这是减缓python 3采用速度的大问题。您可以在http://pypi.python.org/pypi?:action=browse&c=533&show=all中看到哪些软件包支持python 3。 –