2.6 KiB
module ed25519
Contents
Constants
const public_key_size = 32
public_key_size is the sizeof public keys in bytes
const private_key_size = 64
private_key_size is the sizeof private keys in bytes
const signature_size = 64
signature_size is the size of signatures generated and verified by this modules, in bytes.
const seed_size = 32
seed_size is the size of private key seeds in bytes
generate_key
fn generate_key() !(PublicKey, PrivateKey)
generate_key generates a public/private key pair entropy using crypto.rand.
new_key_from_seed
fn new_key_from_seed(seed []u8) PrivateKey
new_key_from_seed calculates a private key from a seed. private keys of RFC 8032 correspond to seeds in this module
sign
fn sign(privatekey PrivateKey, message []u8) ![]u8
sign`signs the message with privatekey and returns a signature
verify
fn verify(publickey PublicKey, message []u8, sig []u8) !bool
verify reports whether sig is a valid signature of message by publickey.
PrivateKey
type PrivateKey = []u8
PrivateKey is Ed25519 private keys
seed
fn (priv PrivateKey) seed() []u8
seed returns the private key seed corresponding to priv. RFC 8032's private keys correspond to seeds in this module.
public_key
fn (priv PrivateKey) public_key() PublicKey
public_key returns the []u8 corresponding to priv.
equal
fn (priv PrivateKey) equal(x []u8) bool
currentyly x not crypto.PrivateKey
sign
fn (priv PrivateKey) sign(message []u8) ![]u8
sign signs the given message with priv.
PublicKey
type PublicKey = []u8
PublicKey is Ed25519 public keys.
equal
fn (p PublicKey) equal(x []u8) bool
equal reports whether p and x have the same value.