C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
Loading...
Searching...
No Matches
xor_cipher.c
Go to the documentation of this file.
1/**
2 * @file xor_cipher.c
3 */
4
5#include "xor_cipher.h"
6
7void xor_apply(unsigned char *text, size_t len,
8 const unsigned char *key, size_t keylen) {
9 if (!text || !key || keylen == 0) return;
10 for (size_t i = 0; i < len; i++) {
11 text[i] ^= key[i % keylen];
12 }
13}
void xor_apply(unsigned char *text, size_t len, const unsigned char *key, size_t keylen)
Definition xor_cipher.c:7
XOR stream cipher — repeating key.