Skip to content

Experimental Integrated Encryption Scheme on Ed25519 using MORUS-1280-128 and Blake3

License

Notifications You must be signed in to change notification settings

bamboolabs-foundation/ecies-ed25519-morus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ecies-ed25519-morus

Crates.io docs.rs GitHub

Experimental ECIES on Twisted Edwards Curve25519 and MORUS-1280-128

Notes

Example

use rand_core::RngCore;
use ecies_ed25519_morus::{encrypt_into, decrypt_into};

const BUFFER_SIZE: usize = 512 * 1024; // avoid higher than this to prevent stackoverflow
let mut rng = rand_core::OsRng::default();
let sender_keypair = ed25519_dalek::SigningKey::generate(&mut rng);
let receiver_keypair = ed25519_dalek::SigningKey::generate(&mut rng);
let sender_public = sender_keypair.verifying_key();
let receiver_public = receiver_keypair.verifying_key();
let mut random_message = [0u8; BUFFER_SIZE];
let mut decrypted_message = [0u8; BUFFER_SIZE];
let mut ciphertext = [0u8; BUFFER_SIZE];
rng.fill_bytes(&mut random_message);

let decrypt_materials = encrypt_into(
    &mut rng,
    &sender_keypair,
    &receiver_public,
    &[],
    &random_message[..],
    &mut ciphertext[..],
)
.unwrap();
decrypt_into(
    &decrypt_materials,
    &receiver_keypair,
    &sender_public,
    &[],
    &ciphertext[..],
    &mut decrypted_message[..],
)
.unwrap();

assert_eq!(random_message, decrypted_message);
assert_ne!(sender_public, receiver_public);

Features

  • no-std environment (for example: wasm):
cargo add ecies-ed25519-morus --no-default-features --features="pure"
  • std environment (default):
cargo add ecies-ed25519-morus
cargo add ecies-ed25519-morus --features="aarch64-optimizations"

Inspirations

This work is heavily inspired by:

Future Works

  • Encrypt & Decrypt with associated data
  • Improve tests with fuzzers & harnesses
  • Add benchmark information
  • Add example and diagrams to elaborate use cases
  • Implement python and c/c++ wrappers

About

Experimental Integrated Encryption Scheme on Ed25519 using MORUS-1280-128 and Blake3

Resources

License

Stars

Watchers

Forks

Languages