XU XUv0.8.8
中文

API

#crypto/ed25519

import: #crypto/ed25519

counts: 6 fns, 0 methods, 0 types, 4 consts, 0 ifaces

Ed25519 keys, sign, verify.

const public_key_size

XuAPI
pub const public_key_size = 32

Purpose

`crypto/ed25519`: GenerateKey / NewKeyFromSeed / Sign / Verify. Private key is 64 bytes (seed || public), public 32, signature 64. Curve arithmetic uses math/big ( uses crypto/internal/edwards25519). Field ops take p as an argument so scalarmult can hoist 2^255-19 and 2d. XU-CT-CLASS: variable-time XU-CT-USE: fixed-shape-only math/big curve arithmetic is variable-time; crypto/subtle covers only the final encoded-point equality check. Value `32`.

Parameters

none

const private_key_size

XuAPI
pub const private_key_size = 64

Purpose

Public constant `private_key_size`. Value `64`.

Parameters

none

const signature_size

XuAPI
pub const signature_size = 64

Purpose

Public constant `signature_size`. Value `64`.

Parameters

none

const seed_size

XuAPI
pub const seed_size = 32

Purpose

Public constant `seed_size`. Value `32`.

Parameters

none

new_key_from_seed

XuAPI
pub fn new_key_from_seed(seed string) string

Purpose

Construct key from seed. Throws on failure.

Parameters

seed string
random seed (string)

Returns

string — result string

generate_key

XuAPI
pub fn generate_key() string

Purpose

Generate key. Throws on failure.

Parameters

none

Returns

string — result string

public

XuAPI
pub fn public(priv &string) string

Purpose

public; returns string. Throws on failure.

Parameters

priv &string
priv (borrowed; caller keeps it; type &string)

Returns

string — result string

seed

XuAPI
pub fn seed(priv &string) string

Purpose

seed; returns string. Throws on failure.

Parameters

priv &string
priv (borrowed; caller keeps it; type &string)

Returns

string — result string

sign

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

Purpose

Sign. Throws on failure.

Parameters

private_key &string
private_key (borrowed; caller keeps it; type &string)
message &string
message (borrowed; caller keeps it; type &string)

Returns

string — result string

verify

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

Purpose

Verify.

Parameters

public_key &string
public_key (borrowed; caller keeps it; type &string)
message &string
message (borrowed; caller keeps it; type &string)
sig &string
sig (borrowed; caller keeps it; type &string)

Returns

bool — true or false