I have two strings in python stored in variables a and b. a is an argument passed to the script and b is the result from decoding the result of win32crypt. I've finally used repr to compare them and no surprise the argument comes back as the word 'windows' but b comes back as 'w\x00i\x00n\x00d\x00o\x00w\x00s\x00'. I know that I can probably write some code to get rid of the \x00s and I have found online that this is some way of essentially adding accents to characters but was wondering if there is a better way to convert b to plain text or to convert a to be in the same format that b is in. Below is a basic representation of the code without the imports.
def decrypt(password):
_, decrypted_password_string = win32crypt.CryptUnprotectData(binascii.unhexlify(password), None, None, None, 0)
#print(decrypted_password_string.decode())
return decrypted_password_string.decode()
main(a):
b = encryptedstringfromcsv
b=decrypt(b)
if a == b:
print('true')
else:
print('false')
always prints false, im assuming due to the repr value. I want it to print true
@JonSG specified above that I can decode utf-16. Adding that to the decode section in my decrypt function fixed it. Thanks a lot :)