Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sasuke40/rsa
https://github.com/sasuke40/rsa
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sasuke40/rsa
- Owner: SASUKE40
- Created: 2023-04-02T04:24:38.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-04-18T07:13:48.000Z (over 1 year ago)
- Last Synced: 2024-05-02T02:05:19.528Z (8 months ago)
- Language: Rust
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);
```