4 ms·
`for char in message: encrypted_char = ord(char) ^ (shared_secret[0] % 256)` This is not real encryption, it picks only one byte of shared secret and XORs it i
by leijurv 2y ago
`for char in message: encrypted_char = ord(char) ^ (shared_secret[0] % 256)`
This is not real encryption, it picks only one byte of shared secret and XORs it into the plaintext. Therefore, there are only 256 possible decryption keys to check, which is trivial.
Instead, you'd want to use the shared secret as a key to something strong and symmetric like AES.
- tptacek 2y agoI don't think it's meant to be real encryption.
- leijurv 2y agoI suspect it was, given that they've now deleted their comment.
- thechao 2y agoAny idiot knows not to use power-of-two! You gotta use "+13", which is prime and, therefore, *secure*.
- BobbyTables2 2y agoAnd Twice is nice!
- Jerrrrrrry 2y agoand more than thrice increases your chances of collision by