ecies-ed25519-morus

Crates.ioecies-ed25519-morus
lib.rsecies-ed25519-morus
version0.2.0
sourcesrc
created_at2023-06-30 16:56:16.626007
updated_at2023-07-01 03:30:26.144877
descriptionExperimental Integrated Encryption Scheme on Ed25519 using MORUS-1280-128 and Blake3
homepage
repositoryhttps://github.com/ujang360/ecies-ed25519-morus
max_upload_size
id904777
size40,276
Aditya Kresna (Ujang360)

documentation

README

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
Commit count: 6

cargo fmt