This project demonstrates various fundamental cryptographic concepts and techniques implemented in Rust. It serves as a practical exploration of different cryptographic primitives and techniques.
- Implementation of two different hash functions:
- SHA-256: A widely used cryptographic hash function from the SHA-2 family
- Poseidon: A zero-knowledge proof friendly hash function optimized for arithmetic circuits
- Demonstrates two core RSA functionalities:
- Asymmetric Encryption: Implementation of RSA encryption/decryption
- Digital Signatures: RSA-based digital signature creation and verification
- Uses 2048-bit keys for security
- Implementation of the ElGamal public-key cryptosystem
- Includes:
- Key generation
- Message encryption
- Message decryption
- Based on the difficulty of the discrete logarithm problem
- Implementation of a Merkle Tree data structure
- Features:
- Tree construction from leaf values
- Merkle proof generation
- Proof verification
- Uses SHA-256 as the underlying hash function
- Implementation of the Diffie-Hellman key exchange protocol
- Demonstrates how two parties can establish a shared secret over an insecure channel
- Includes public and private key generation and shared secret computation
- (Currently commented out in main.rs as it is uncompleted)
- Implementation of the Pedersen commitment scheme
- A cryptographic primitive that allows committing to a value while keeping it hidden
The main.rs
file demonstrates the usage of each cryptographic implementation. To run the project:
cargo run
dusk-bls12-381
: For BLS12-381 curve operationsdusk-poseidon
: For Poseidon hash implementationrsa
: For RSA cryptographyrand
: For secure random number generationrs-merkle
: For Merkle tree implementation
This project serves as an educational resource for understanding various cryptographic concepts through practical implementation. It's important to note that while these implementations demonstrate the concepts, they may not be suitable for production use without additional security considerations and auditing.
These implementations are for learning purposes and may not include all the necessary security measures required for production systems. For real-world applications, it's recommended to use well-audited cryptographic libraries.