Realize my 'fixed' XOR is already repeating-key

This commit is contained in:
Horseshoe Crab 2022-04-27 00:43:03 -07:00
parent 7a18aab19b
commit b8f9f6f247
1 changed files with 3 additions and 3 deletions

View File

@ -3,13 +3,13 @@
#include <stdlib.h> #include <stdlib.h>
/* /*
void fixed_xor_stream(uint8_t *key, size_t key_len) void repeating_key_xor_stream(uint8_t *key, size_t key_len)
{ {
// //
} }
*/ */
void fixed_xor(const uint8_t *data, const size_t data_len, void repeating_key_xor(const uint8_t *data, const size_t data_len,
const uint8_t *key, const size_t key_len) const uint8_t *key, const size_t key_len)
{ {
uint8_t c; uint8_t c;
@ -30,7 +30,7 @@ int main()
uint8_t key[] = "\x68\x69\x74\x20\x74\x68\x65\x20\x62\x75\x6c\x6c\x27" uint8_t key[] = "\x68\x69\x74\x20\x74\x68\x65\x20\x62\x75\x6c\x6c\x27"
"\x73\x20\x65\x79\x65"; "\x73\x20\x65\x79\x65";
fixed_xor(data, sizeof(data)-1, key, sizeof(key)-1); repeating_key_xor(data, sizeof(data)-1, key, sizeof(key)-1);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }