Experimental ECIES on Twisted Edwards Curve25519 and MORUS-1280-128
sign & verify
keypair in the ed25519
scheme for accomplishing ECIES
. We call this, a perversion because we should only use the ephemeral ones
(except for the recipient).```rust use randcore::RngCore; use eciesed25519morus::{encryptinto, decrypt_into};
const BUFFERSIZE: usize = 512 * 1024; // avoid higher than this to prevent stackoverflow let mut rng = randcore::OsRng::default(); let senderkeypair = ed25519dalek::SigningKey::generate(&mut rng); let receiverkeypair = ed25519dalek::SigningKey::generate(&mut rng); let senderpublic = senderkeypair.verifyingkey(); let receiverpublic = receiverkeypair.verifyingkey(); let mut randommessage = [0u8; BUFFERSIZE]; let mut decryptedmessage = [0u8; BUFFERSIZE]; let mut ciphertext = [0u8; BUFFERSIZE]; rng.fillbytes(&mut random_message);
let decryptmaterials = encryptinto( &senderkeypair, &receiverpublic, &mut rng, &randommessage[..], &mut ciphertext[..], ) .unwrap(); decryptinto( &receiverkeypair, &senderpublic, &decryptmaterials, &ciphertext[..], &mut decryptedmessage[..], ) .unwrap();
asserteq!(randommessage, decryptedmessage); assertne!(senderpublic, receiverpublic); ```
no-std
environment (for example: wasm):bash
cargo add ecies-ed25519-morus --no-default-features --features="pure"
std
environment (default):bash
cargo add ecies-ed25519-morus
std
and aarch64
environment (for example: Apple Silicon)bash
cargo add ecies-ed25519-morus --features="aarch64-optimizations"
This work is heavily inspired by:
no-std
(see: these lines)python
and c/c++
wrappers