Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aes.decrypt quando a chave está errada #5

Closed
Ranguna opened this issue Dec 9, 2018 · 3 comments
Closed

aes.decrypt quando a chave está errada #5

Ranguna opened this issue Dec 9, 2018 · 3 comments
Assignees

Comments

@Ranguna
Copy link
Owner

Ranguna commented Dec 9, 2018

A função de decrypt do AESCipher deve retornar None ou fazer raise quando a chave está errada:

aes.AESCipher("321").decrypt(aes.AESCipher("123").encrypt("asd"))

Às vezes dá erro e outra dá b''.
Isto às vezes funciona:

aes.AESCipher("123").decrypt(aes.AESCipher("123").encrypt("")) == aes.AESCipher("321").decrypt(aes.AESCipher("123").encrypt("asd"))

Talvez concatenar o hash da mensagem no fim e quando decifras, pegas nos ultimos bytes e comparas com o hash da mensagem decifrada (menos os ultimos bytes):

encrypt("asd") => cifrar('asd(n bytes de hash("asd"))') => criptograma
decrypt(criptograma) => 'asd(n bytes de hash("asd"))' => hash("asd") == (n bytes de hash("asd"))
@JotaN98 JotaN98 self-assigned this Dec 9, 2018
@JotaN98 JotaN98 closed this as completed Dec 11, 2018
@Ranguna
Copy link
Owner Author

Ranguna commented Dec 11, 2018

Cadê commit ?

@Ranguna Ranguna reopened this Dec 11, 2018
@JotaN98
Copy link
Collaborator

JotaN98 commented Dec 11, 2018 via email

@JotaN98
Copy link
Collaborator

JotaN98 commented Dec 11, 2018

commit
enter
stage changes

@JotaN98 JotaN98 closed this as completed Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants