## crypto::ed25519+x86_64 +linux

This module implements the ed25519 signature algorithm, as defined by RFC 8032.

Do not use the same secret key for both key exchanges and signatures. The public keys are different and revealing both may leak information.

This is a low-level module which implements cryptographic primitives. Direct use of cryptographic primitives is not recommended for non-experts, as incorrect use of these primitives can easily lead to the introduction of security vulnerabilities. Non-experts are advised to use the high-level operations available in the top-level crypto:: module.

Be advised that Hare's cryptography implementations have not been audited.

### Index

#### Types

// Undocumented types: type privkey = [PRIVKEYSZ]u8; type pubkey = [PUBKEYSZ]u8; type seed = [SEEDSZ]u8;

#### Constants

def PRIVKEYSZ: size = 64; def PUBKEYSZ: size = 32; def SEEDSZ: size = 32; def SIGNATURESZ: size = 64;

#### Functions

fn privkey_getpubkey(priv: []u8) pubkey; fn privkey_init(priv: []u8, seed: []u8) void; fn sign(priv: []u8, msg: []u8) [SIGNATURESZ]u8; fn verify(pub: []u8, msg: []u8, sig: []u8) bool;

### Types

#### type privkey[link]

## Show undocumented member

type privkey = [PRIVKEYSZ]u8;

#### type pubkey[link]

## Show undocumented member

type pubkey = [PUBKEYSZ]u8;

#### type seed[link]

## Show undocumented member

type seed = [SEEDSZ]u8;

### Constants

#### def PRIVKEYSZ[link]

def PRIVKEYSZ: size = 64;

The size of an Ed25519 private key.

#### def PUBKEYSZ[link]

def PUBKEYSZ: size = 32;

The size of an Ed25519 public key.

#### def SEEDSZ[link]

def SEEDSZ: size = 32;

The size of an Ed25519 seed.

#### def SIGNATURESZ[link]

def SIGNATURESZ: size = 64;

The size of an Ed25519 signature.

### Functions

#### fn privkey_getpubkey[link]

fn privkey_getpubkey(priv: []u8) pubkey;

Derive the public key for a given private key. '

#### fn privkey_init[link]

fn privkey_init(priv: []u8, seed: []u8) void;

Derives a new Ed25519 private key from a given seed. The seed must be initialized to cryptographically random data; crypto::random:: is recommended for this purpose.

#### fn sign[link]

fn sign(priv: []u8, msg: []u8) [SIGNATURESZ]u8;

Signs a message with a private key, returning the signature.

#### fn verify[link]

fn verify(pub: []u8, msg: []u8, sig: []u8) bool;

Given a public key, verifies a signature produced with the corresponding private key for a given message, returning true if the signature is valid and false otherwise.