C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
Loading...
Searching...
No Matches
xor_cipher.h
Go to the documentation of this file.
1
/**
2
* @file xor_cipher.h
3
* @brief XOR stream cipher — repeating key.
4
*
5
* The same function encrypts and decrypts (XOR is its own inverse).
6
* NOT cryptographically secure on its own — included as a teaching
7
* primitive and a building block for one-time-pad demonstrations.
8
*/
9
10
#ifndef XOR_CIPHER_H
11
#define XOR_CIPHER_H
12
13
#include <stddef.h>
14
15
/** XOR each byte of `text[0..len)` with the cyclic key. */
16
void
xor_apply
(
unsigned
char
*text,
size_t
len,
17
const
unsigned
char
*key,
size_t
keylen);
18
19
#endif
/* XOR_CIPHER_H */
xor_apply
void xor_apply(unsigned char *text, size_t len, const unsigned char *key, size_t keylen)
Definition
xor_cipher.c:7
algorithms
encryption
xor_cipher.h
Generated by
1.9.8