In aes.py there is 4 time this code: if str(type(data)) != "<type 'string'>":
With python 2.3, it doesn't work, much better to use: if str(type(data)) != str(type("")):
Logged In: YES user_id=588604
Oooppsss... sorry. It's dupe.
Logged In: NO
Replace if str(type(data)) != "<type 'string'>" With if str(type(data)) != "<type 'string'>" and str(type(data)) != "<type 'str'>":
Also occurences in sha256
or rather, if type(data) != str:
seems to work with all snake types.
Logged In: YES user_id=1216160
heres a patch to get it work with any version of Python using the provided Types Module and not string compare ;)
--- aes/src/aes.py 2001-11-30 17:30:04.000000000 +0100 +++ /usr/lib/python2.3/site-packages/aes/aes.py 2006-04-29 17:18:30.000000000 +0200 @@ -37,6 +37,7 @@ # #====================================================================
+from types import * from rijndaelc import *
noSHA256=0 @@ -189,7 +190,7 @@ The encrypted string (with NULL bytes) is returned. """
- if str(type(data)) != "<type 'string'>": + if type(data) != StringType: raise TypeError('Data to encrypt must be a string')
if not self.keyMaterial: @@ -210,7 +211,7 @@ you, check the key you're using! """
- if str(type(data)) != "<type 'string'>": + if type(data) != StringType: raise TypeError('Data to decrypt must be a string')
if not self.keyMaterial: @@ -236,7 +237,7 @@ if noSHA256: raise RuntimeError("Need sha256 module to lazyEncrypt")
hasher = sha256() @@ -266,7 +267,7 @@ if noSHA256: raise RuntimeError("Need sha256 module to lazyDecrypt")
hasher = sha256()
Log in to post a comment.
Logged In: YES
user_id=588604
Oooppsss... sorry.
It's dupe.
Logged In: NO
Replace
if str(type(data)) != "<type 'string'>"
With
if str(type(data)) != "<type 'string'>" and
str(type(data)) != "<type 'str'>":
Also occurences in sha256
Logged In: NO
or rather,
if type(data) != str:
seems to work with all snake types.
Logged In: YES
user_id=1216160
heres a patch to get it work with any version of Python
using the provided Types Module and not string compare ;)
--- aes/src/aes.py 2001-11-30 17:30:04.000000000 +0100
+++ /usr/lib/python2.3/site-packages/aes/aes.py 2006-04-29
17:18:30.000000000 +0200
@@ -37,6 +37,7 @@
#
#====================================================================
+from types import *
from rijndaelc import *
noSHA256=0
@@ -189,7 +190,7 @@
The encrypted string (with NULL bytes) is returned.
"""
- if str(type(data)) != "<type 'string'>":
+ if type(data) != StringType:
raise TypeError('Data to encrypt must be a string')
if not self.keyMaterial:
@@ -210,7 +211,7 @@
you, check the key you're using!
"""
- if str(type(data)) != "<type 'string'>":
+ if type(data) != StringType:
raise TypeError('Data to decrypt must be a string')
if not self.keyMaterial:
@@ -236,7 +237,7 @@
if noSHA256:
raise RuntimeError("Need sha256 module to lazyEncrypt")
- if str(type(data)) != "<type 'string'>":
+ if type(data) != StringType:
raise TypeError('Data to encrypt must be a string')
hasher = sha256()
@@ -266,7 +267,7 @@
if noSHA256:
raise RuntimeError("Need sha256 module to lazyDecrypt")
- if str(type(data)) != "<type 'string'>":
+ if type(data) != StringType:
raise TypeError('Data to decrypt must be a string')
hasher = sha256()