Okay, I'm totally new to Python, so I decided to make a simple app. Here is my encryption function:
from Crypto.Cipher import AES
def encPass(login, password):
keyPhr=os.environ['HOME']+login
hashObj = hashlib.md5()
hashObj.update(keyPhr)
keyPhr=hashObj.hexdigest()
keyObj=AES.new(keyPhr)
encPwd=keyObj.encrypt(password+'pssd')
return encPwd
as you see, it gets login and pass, and encrypt pass with binding to pc.
The problem is when i try to feed encPws to sqlite3 and insert it into a table, it says:
sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
If i try to put encPwd in unicode() or hex():
TypeError: hex() argument can't be converted to hex
UnicodeDecodeError: 'utf8' codec can't decode byte 0x9c in position 0: unexpected code byte
I guess it's because i'm newbie, but what should I do? The same with Blowfish instead of AES