XU XUv0.16.0

#crypto/ed25519

import: #crypto/ed25519

counts: 6 functions, 0 methods, 0 types, 4 constants, 0 method sets

Ed25519 keys, sign, verify.

const PUBLIC_KEY_SIZE

XuAPI
pub const PUBLIC_KEY_SIZE = 32

Purpose

Constant PUBLIC_KEY_SIZE, defining protocol or algorithm parameters.

const PRIVATE_KEY_SIZE

XuAPI
pub const PRIVATE_KEY_SIZE = 64

Purpose

Constant PRIVATE_KEY_SIZE, defining protocol or algorithm parameters.

const SIGNATURE_SIZE

XuAPI
pub const SIGNATURE_SIZE = 64

Purpose

Constant SIGNATURE_SIZE, defining protocol or algorithm parameters.

const SEED_SIZE

XuAPI
pub const SEED_SIZE = 32

Purpose

Constant SEED_SIZE, defining protocol or algorithm parameters.

new_key_from_seed

XuAPI
pub fn new_key_from_seed(seed string) string

Purpose

Construct key from seed. Throws on failure; handle the error or propagate it to the caller.

Parameters

seed string
random seed (string)

Returns

string — result string

generate_key

XuAPI
pub fn generate_key() string

Purpose

Generate key. Throws on failure; handle the error or propagate it to the caller.

Parameters

No arguments are required.

Returns

string — result string

public

XuAPI
pub fn public(priv &string) string

Purpose

Execute public. Throws on failure; handle the error or propagate it to the caller.

Parameters

priv &string
priv (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

seed

XuAPI
pub fn seed(priv &string) string

Purpose

Execute seed. Throws on failure; handle the error or propagate it to the caller.

Parameters

priv &string
priv (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

sign

XuAPI
pub fn sign(private_key &string, message &string) string

Purpose

Compute digital signature using private key. Throws on failure; handle the error or propagate it to the caller.

Parameters

private_key &string
private_key (read-only borrow; caller keeps the original; type &string)
message &string
message (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

verify

XuAPI
pub fn verify(public_key &string, message &string, sig &string) bool

Purpose

Verify whether digital signature matches message.

Parameters

public_key &string
public_key (read-only borrow; caller keeps the original; type &string)
message &string
message (read-only borrow; caller keeps the original; type &string)
sig &string
sig (read-only borrow; caller keeps the original; type &string)

Returns

bool — true or false