C Fundamentals
Algorithms · data structures · cryptography · systems — pure C11, zero deps
Loading...
Searching...
No Matches
xor_cipher.h File Reference

XOR stream cipher — repeating key. More...

#include <stddef.h>

Go to the source code of this file.

Functions

void xor_apply (unsigned char *text, size_t len, const unsigned char *key, size_t keylen)
 

Detailed Description

XOR stream cipher — repeating key.

The same function encrypts and decrypts (XOR is its own inverse). NOT cryptographically secure on its own — included as a teaching primitive and a building block for one-time-pad demonstrations.

Definition in file xor_cipher.h.

Function Documentation

◆ xor_apply()

void xor_apply ( unsigned char *  text,
size_t  len,
const unsigned char *  key,
size_t  keylen 
)

XOR each byte of text[0..len) with the cyclic key.

Definition at line 7 of file xor_cipher.c.

Referenced by main().