Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sasuke40/rsa


https://github.com/sasuke40/rsa

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# RSA

## Usage

```rust
let private_key = PrivateKey::new().expect("failed to generate a private key");
println!("Private Key: {:?}", private_key);
let public_key = PublicKey::from(&private_key);
println!("Public Key: {:?}", public_key);
let m = BigUint::from_bytes_le(&[42]);
println!("Message: {:?}", m);
let c = public_key.encrypt(&m);
println!("Encrypted message: {:?}", c);
let m_decrypted = private_key.decrypt(&c).expect("failed to decrypt");
println!("Decrypted message: {:?}", m_decrypted);
```