-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencryption.h
More file actions
26 lines (18 loc) · 979 Bytes
/
encryption.h
File metadata and controls
26 lines (18 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef ENCRYPTION_H
#define ENCRYPTION_H
#include <stddef.h> // for size_t
#include <stdint.h> // for uint8_t
// --- Function Declarations ---
// Generate a key-based pseudo keystream
void generate_keystream(uint8_t *keystream, size_t len, const uint8_t *key, size_t keylen);
// Generate key-based permutation using Fisher–Yates shuffle
void generate_permutation(size_t *perm, size_t len, const uint8_t *key, size_t keylen);
// Invert permutation (used during decryption)
void invert_permutation(size_t *inv, const size_t *perm, size_t len);
// Encrypt plaintext into cipher using XOR + substitution + transposition
void hybrid_encrypt(const uint8_t *plaintext, uint8_t *cipher, size_t len,
const uint8_t *key, size_t keylen);
// Decrypt cipher back into plaintext (reverse of encryption)
void hybrid_decrypt(const uint8_t *cipher, uint8_t *plaintext, size_t len,
const uint8_t *key, size_t keylen);
#endif // ENCRYPTION_H