Skip to content

crypto.ed25519 #

Description

crypto.ed25519 implements the ed25519 public key digital signature algorithm for the V Language. The module is ported from the Go version of crypto.ed25519.

See Ed25519 for more detail about ed25519.

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

fn generate_key #

fn generate_key() !(PublicKey, PrivateKey)

generate_key generates a public/private key pair entropy using crypto.rand.

fn 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

fn sign #

fn sign(privatekey PrivateKey, message []u8) ![]u8

sign`signs the message with privatekey and returns a signature

fn verify #

fn verify(publickey PublicKey, message []u8, sig []u8) !bool

verify reports whether sig is a valid signature of message by publickey.

type PrivateKey #

type PrivateKey = []u8

PrivateKey is Ed25519 private keys

fn (PrivateKey) 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.

fn (PrivateKey) public_key #

fn (priv PrivateKey) public_key() PublicKey

public_key returns the []u8 corresponding to priv.

fn (PrivateKey) equal #

fn (priv PrivateKey) equal(x []u8) bool

currentyly x not crypto.PrivateKey

fn (PrivateKey) sign #

fn (priv PrivateKey) sign(message []u8) ![]u8

sign signs the given message with priv.

type PublicKey #

type PublicKey = []u8

PublicKey is Ed25519 public keys.

fn (PublicKey) equal #

fn (p PublicKey) equal(x []u8) bool

equal reports whether p and x have the same value.