Python 3 Byte Input Error
You can't use escape characters when inputting data - you have to actually enter the binary value associated with that character, so rather than \x00, you would need the actual NUL character. This is obviously not practical, so there are a couple of different things that you could try. Firstly, rather than generating a random key, get the user to enter a passphrase, then put it through a key derivation function (you could use something like MD5, though usually stronger functions like PBKDF2 are used to make brute force less effective. This means that the user can also remember the key. Alternatively, encode the generated key using either hex or base64, so that the user only has to type ascii characters, then decode what they typed to get what actually needs to be passed into the function as the key.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now