Raw Crypto Library is to provide crypto implementations in C/C++ with rust. Currently the library has implemented all hash functions provided by the cryptonote foundation in it's referential coin forging code base.
Now this library provide the follow interfaces:
Hash
Hash::slow -> cnslowhash
Hash::fast -> cnfasthash
Chacha(with ChachaKey, ChachaIV generators)
Chacha::generate -> chacha8
Key
Key::generateprivatekey -> generateprivatekey
Key::secrettopublic -> secretkeytopublickey
Key::generatekeypair -> generatekeys
Key::checkpublickey -> checkpublickey
Key::generatekeyderivation -> generatekeyderivation
Key::derivepublickey -> derivepublickey
Key::underivepublickey -> underivepublickey
Key::derivesecretkey -> derivesecretkey
Key::generatesignature -> generatesignature
Key::checksignature -> checksignature
Key::generatekeyimage -> generatekey_image
Ring
Ring::generatesignature -> generateringsignature Ring::checksignature -> checkringsignature
Usage can be found in tests.
``` // Generate key let key = ChachaKey::generate(String::from(""));
// Generate iv
let iv = ChachaIV::from([0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18]);
// Generate chacha object
let chacha = Chacha::new(key, iv);
// Prepare plain text
let plain = *b"hello world!";
// Encrypt with chacha8
let cipher = chacha.encrypt(&plain[..]);
// Encrypt again will get the original plain text
let recipher = chacha.encrypt(&cipher[..]);
// they should be equal
assert!(plain == recipher.as_slice());
```