docs.rs failed to build enocoro128v2-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
enocoro128v2-0.1.6
enocoro128v2
Safe Rust, #![no_std]
implementation of Enocoro-128v2 [1], the updated variant [2] of a lightweight, CRYPTREC candidate [3] stream cipher.
No practical attacks against Enocoro-128v2 have been reported [4].
Functionality
- Symmetric-key encryption
- Pseudo-Random Number Generator (PRNG)
Implementation
- Operational in baremetal environments: no standard library dependencies, no dynamic memory allocation
- State securely wiped from memory on drop [5]
- Close mapping to Hitachi's C reference implementation [6] for audit-friendly code
- Verified using Hitachi's official test vectors [7]
Usage
When the entirety of the plaintext or ciphertext is in-memory at once, a simplified API can be used:
use Enocoro128;
let key: = ;
let iv: = ;
let plaintext = ; // "Hello world!"
let mut msg: = plaintext.clone;
// Encrypt in-place
apply_keystream_static;
assert_ne!;
// Decrypt in-place
apply_keystream_static;
assert_eq!;
If entirety of the plaintext or ciphertext is never in memory at once (e.g. data received/transmitted in chunks, potentially of varying sizes):
use Enocoro128;
let key: = ;
let iv: = ;
let plaintext_1 = ; // "Hello"
let plaintext_2 = ; // " world!"
let mut msg_1 = plaintext_1.clone;
let mut msg_2 = plaintext_2.clone;
// Create an instance of the cipher
let mut e128 = new;
// Encrypt in-place
e128.apply_keystream;
e128.apply_keystream;
assert_ne!;
assert_ne!;
// Reset keystream prior to decryption
e128.init_keystream;
// Decrypt in-place
e128.apply_keystream;
e128.apply_keystream;
assert_eq!;
assert_eq!;
To generate random buffers or numbers from the keystream (note the caller is responsible for using a platform specific entropy source to create the key and IV, these values seed the PRNG!):
use Enocoro128;
let key: = ;
let iv: = ;
let mut my_rand_buf = ;
let mut my_rand_u16: u16 = 0;
let mut my_rand_u64: u64 = 0;
let mut e128 = new;
e128.rand_buf;
assert!;
my_rand_u16 = e128.rand_u16;
assert_ne!;
my_rand_u64 = e128.rand_u64;
assert_ne!;
References
- [1] "Pseudorandom Number Generator Enocoro", Hitachi Corporation (2010)
- [2] "Update on Enocoro Stream Cipher", Dai Watanabe et. al. (2010)
- [3] "Specifications of Ciphers in the Candidate Recommended Ciphers List", CRYPTREC (2013)
- [4] "Security Evaluation of Stream Cipher Enocoro-128v2", Martin Hell and Thomas Johansson (2010)
- [5] "zeroize", Tony Arcieri (2019)
- [6] enocoro_ref_20100222.zip, Hitachi Corporation (2010)
- [7] enocoro_tv_20100202.zip, Hitachi Corporation (2010)