0
Developing an encryption algorithm, at some point the user will insert the message to be decrypted. The message will be inserted in bytes, in the format b'\xf4\x88A\x0f1\xab\x91\x93\xa7-\xc9\xe7\x99:\x0c\xa3'
.
The problem is that by entering this value in input
, it is received in the variable as if it were a string, which generates error. Likewise, if you make a new conversion to bytes, the value received as a string will also generate error, as you will be converting a message "already converted".
There is a way to make the data be received as bytes, so that I can simply send it to the function and decrypt it?
P.S.1 When I try through the msg = bytes(input("Mensagem a ser decifrada: "))
returns the error TypeError: string argument without an encoding
P.S.2 When I pass the message in direct bytes as argument the function works smoothly: ofb(chave, b'q\xbb3\xd8\xab\x1a2AM\xb0?\x8a\n\xc6\xd1\xce', op)