use ed25519_axolotl::{
fast_signature,
full_signature,
decode_message,
random_bytes,
str_to_vec32,
vec32_to_str,
KeyPair
verify,
};
// seed: Vec<u32>
// let keys = KeyPair::new(Some(seed));
let keys = KeyPair::new(None);
println!("{}", keys);
- 64 byte signature
- quick to sign and verify
- don't possible to decode signature back to message
let keys = KeyPair::new(None);
let msg = str_to_vec32("hello e25519 axolotl".to_string());
let signature = fast_signature(
keys.prvk,
msg.clone(),
Some(random_bytes(64))
);
assert_eq!(verify(keys.pubk, msg, signature), true);
println!("ok");
- (64 + message length) byte signature
- slow to sign and verify
- it is possible to decode the signature back to the message
let keys = KeyPair::new(None);
let msg = str_to_vec32("hello e25519 axolotl".to_string());
let signature = full_signature(
keys.prvk,
msg.clone(),
Some(random_bytes(64))
);
assert_eq!(verify(keys.pubk, msg, signature), true);
println!("ok");
- possible only for full_signature function
let keys = KeyPair::new(None);
let msg = str_to_vec32("hello e25519 axolotl".to_string());
let mut sign_msg = full_signature(
keys.prvk,
msg.clone(),
Some(random_bytes(64))
);
let decoded_msg = decode_message(keys.pubk, &mut sign_msg);
assert_eq!(msg, decoded_msg);
println!("ok");
import * as wasm from "ed25519_axolotl";
or
const wasm = require("ed25519_axolotl")
const keys = new wasm.KeyPair()
console.log(keys.privateKey) // Uint32Array
console.log(keys.publiKey) // Uint32Array
- 64 byte signature
- quick to sign and verify
- don't possible to decode signature back to message
const keys = new wasm.KeyPair()
console.log(keys.privateKey) // Uint32Array
console.log(keys.publiKey) // Uint32Array
const msg = wasm.stringToUint32Array("hello lunes")
console.log(msg) // Uint32Array
const signature = wasm.fastSignature(k.privateKey, msg, wasm.randomBytes(64))
console.log(signature) // Uint32Array
- (64 + message length) byte signature
- slow to sign and verify
- it is possible to decode the signature back to the message
const keys = new wasm.KeyPair()
console.log(keys.privateKey) // Uint32Array
console.log(keys.publiKey) // Uint32Array
const msg = wasm.stringToUint32Array("hello lunes")
console.log(msg) // Uint32Array
const signature = wasm.fullSignature(k.privateKey, msg, wasm.randomBytes(64))
console.log(signature) // Uint32Array
- possible only for full_signature function
const keys = new wasm.KeyPair()
console.log(keys.privateKey) // Uint32Array
console.log(keys.publiKey) // Uint32Array
const msg = wasm.stringToUint32Array("hello lunes")
console.log(msg) // Uint32Array
const signature = wasm.fullSignature(k.privateKey, msg, wasm.randomBytes(64))
console.log(signature) // Uint32Array
const dmsg = wasm.uint32ArrayToString(
wasm.decode_message(k.publiKey, fl)
)
console.log(dmsg) // String
- 64 byte signature
- quick to sign and verify
- don't possible to decode signature back to message
- (64 + message length) byte signature
- slow to sign and verify
- it is possible to decode the signature back to the message
- possible only for full_signature function
-
Ported to Rust by Miguel Sandro Lucero, miguel.sandro@gmail.com, 2021.09.11.
-
You can use it under MIT or CC0 license.
-
Curve25519 signatures idea and math by Trevor Perrin, see here
-
Derived from axlsign.js written by Dmitry Chestnykh, see here