So I am busy with a program that takes multiple encoded AES encrypted values from a table and decrypts those values once the value is decrypted it is supposed to check if the input is the same as the decrypted value and from what I am seeing it is but the program still ends up with false here is the code:
username = "AMY"
password = "Aims!@#$%^&*("
print(username)
print(password)
for row in result:
cdata = row[1]
C2 = AES.new(key, AES.MODE_CBC, iv)
plainname = unpad(C2.decrypt(cdata), 16)
data = row[2]
C3 = AES.new(key, AES.MODE_CBC, iv)
plainpass= unpad(C3.decrypt(data),16)
print(plainname.decode())
name = plainname.decode()
if (name == username):
print("true")
the output is:
AMY
Aims!@#$%^&*(
YASU
KASI
JAMES
JASON
JJ
AMY
YASEEN
the first value is the text input the second last value is the value from the table which it should be compared to it should say true when it gets to this value but it is not. My only guesses are either the types are somehow different or maybe I left a space in the database or something like that.
print(repr(plainname.decode()))
so you can see spaces.