Crates.io | playrsa |
lib.rs | playrsa |
version | 0.4.0 |
source | src |
created_at | 2020-03-31 08:23:36.124138 |
updated_at | 2020-03-31 08:23:36.124138 |
description | implementation of RSA cryptography in Rust for pedagogical use |
homepage | https://github.com/getreu/play-rsa/ |
repository | https://github.com/getreu/play-rsa/ |
max_upload_size | |
id | 224775 |
size | 29,799 |
Play-RSA is an implementation of RSA cryptography in Rust 1.
The algorithms are implemented as described on Wikipedia.2 Please find concrete links and pseudocode samples in the source code.
Disclaimer
This code is written for pedagogical use only. It does not provide security in real world settings.
Download, compile and install
> cargo install play-rsa
Test
> play-rsa
Download, unpack and change into directory play-rsa
where the file
Cargo.toml
resides.
> cargo run --release
With my notebook the key generation of the 1024 bit key takes some seconds.
Because all calculations are preformed with the BigUint
type,
the key length is mainly limited by the execution time. 1024 bit seems
a good compromise for the chosen algorithms and hardware.
Sample output for a key length of 256 bits.
FINDING BIG PRIME NUMBERS
'96543390677764721740735128239245428995208381696823499601989570975501893576667 is prime' is a true statement!
RSA PUBLIC KEY ENCRYPTION
Plaintext: 'Coming tomorrow!'
Generating key pair...
* Private key is: d=0x0ae6893332356966ecb6eec38e11a8dc6f6ec7925f5d4f18eb3b1c6c400d39ab, n=0x1059cdcccb501e1a63126625551a7d4b28dd4077e5b850ee69a8551081d2c6f5,
* Public key is: e=0x03, n=0x1059cdcccb501e1a63126625551a7d4b28dd4077e5b850ee69a8551081d2c6f5, key_size=256
Ciphertext: '0x01a93489f8f4bfb95ed88a99ff4faa9894c3f2fa26f401df6f7e40601444fdb2'
Decrypted ciphertext: 'Coming tomorrow!'
Rust version > 1.1 ↩
Some tests are based on jsanders/rust-rsa. ↩