shank03/XORCryptor-Rust

Tests are roundtrip only and do not provide test vectors

Closed this issue · 1 comments

The encryption and decryption tests only demonstrate that the algorithm roundtrips on the current machine. This is generally considered inadequate.

Instead, provide test vectors, something like the following:

Key:
0102030405060708
Plaintext:
4c6f72656d20697073756d20646f6c6f722073697420616d65742c20636f
6e73656374657475722061646970697363696e6720656c69742c20736564
20646f20656975736d6f642074656d706f7220696e6369646964756e7420
7574206c61626f726520657420646f6c6f7265206d61676e6120616c6971
75612e0a
Ciphertext:
[...]

And have test assertions that the key + plaintext encrypts to the ciphertext in the test, as well as a second test asserting that the key + ciphertext decrypts to the plaintext.

The next step in testing is flipping single bits in the ciphertext and asserting that decryption fails, but it won't since this is not an authenticated encryption algorithm.

Will work on this ! Thank you !