How jordi-r66/cryptography works
This repository is a C cryptography toolkit with command-line programs for file encryption and file hashing, plus ElGamal and ChaCha20-Poly1305 APIs. The principal user workflow is generating or supplying a key and nonce, then encrypting a file with ChaCha20; a separate utility streams a file through SHA-256 and prints its digest. ElGamal provides key generation, encryption/decryption, signatures, and key-file serialization. The README is empty, and sampled source does not establish every subsystem’s wiring, so uncertain links are omitted.
Main entry points: file_cipher/main.c File cipher CLI · elgamal.c ElGamal operations · hash_file/main.c File hash CLI · src/main.c Crypto demo entry
Components 21
Command-line tools
- File cipher CLI
src/apps/file_cipher/main.c - File hash CLI
src/apps/hash_file/main.c - Crypto demo entry
src/main.c
Symmetric cryptography
- Key and nonce
src/cipher/symmetric/chacha20/chacha20.c - ChaCha20
src/cipher/symmetric/chacha20/chacha20.c - ChaCha20-Poly1305
src/cipher/symmetric/chacha20poly1305/chacha20poly1305.c - Poly1305 MAC
src/cipher/symmetric/poly1305/poly1305.c - Secure block I/O
src/cipher/symmetric/chacha20poly1305/chacha20poly1305.c
ElGamal cryptography
- ElGamal operations
src/cipher/asymmetric/elgamal/elgamal.c - Prime generation
src/cipher/asymmetric/common/utils.c
Hashing
- SHA-256
src/hash/sha256.c
Other components
- CLI user
- Key file
- Nonce file
- Input file
- Cipher output
- File input
- SHA-256 digest
- ElGamal keys
- Signature
- Integer arithmetic
libs/myOwnCLib
Connections 23
- CLI user → File cipher CLI: runs
- File cipher CLI → Key and nonce: generates keys
- Key and nonce → Key file: exports key
- File cipher CLI → Key file: imports key
- File cipher CLI → Nonce file: writes nonce
- File cipher CLI → Input file: reads chunks
- File cipher CLI → ChaCha20: encrypts chunks
- File cipher CLI → Cipher output: writes ciphertext
- ChaCha20-Poly1305 → ChaCha20: uses stream
- ChaCha20-Poly1305 → Poly1305 MAC: authenticates data
- Secure block I/O → Cipher output: stores blocks
- CLI user → File hash CLI: runs
- File hash CLI → File input: reads chunks
- File hash CLI → SHA-256: updates and finalizes
- File hash CLI → SHA-256 digest: prints digest
- ElGamal operations → Prime generation: generates primes
- ElGamal operations → Integer arithmetic: uses arithmetic
- ElGamal operations → SHA-256: hashes signed data
- Crypto demo entry → ElGamal operations: demonstrates operations
- Crypto demo entry → ChaCha20: demonstrates encryption
- Crypto demo entry → ChaCha20-Poly1305: demonstrates AEAD
- ElGamal operations → ElGamal keys: exports keys
- ElGamal operations → Signature: creates or verifies