Skip to main content

Crate schnorr48

Crate schnorr48 

Source
Expand description

48-byte Schnorr signatures over Ed25519.

This crate provides bandwidth-efficient Schnorr signatures using a truncated 16-byte challenge instead of the standard 32-byte hash. This saves 16 bytes per signature (48 bytes vs 64 bytes) while maintaining ~128-bit security.

§Format

signature = e (16 bytes) || s (32 bytes)

Where:

  • e is the truncated SHA-512 challenge (first 16 bytes)
  • s is the full 32-byte scalar response

§Example

use schnorr48::{Seed, derive_keypair, sign, verify};

// Generate keypair from seed
let seed = Seed::new([0u8; 32]);
let (privkey, pubkey) = derive_keypair(&seed);

// Sign a message
let message = b"hello world";
let signature = sign(&privkey, &pubkey, message);

// Verify
assert!(verify(&pubkey, message, &signature));

§Security

  • Deterministic nonces (RFC 6979 style) prevent nonce reuse
  • Constant-time scalar operations via curve25519-dalek
  • Rejects identity points, low-order points, and non-canonical scalars
  • Key material zeroized on drop

§no_std

This crate is #![no_std] compatible. It requires alloc for the curve25519-dalek dependency.

Structs§

PrivateKey
32-byte Ed25519 private key (clamped scalar).
PublicKey
32-byte Ed25519 public key (compressed point).
Seed
32-byte seed for keypair derivation.

Constants§

SIGNATURE_LEN
Length of a Schnorr48 signature in bytes.

Functions§

derive_keypair
Derive an Ed25519 keypair from a seed.
sign
Sign a message. Returns 48-byte signature e[16] || s[32].
verify
Verify a 48-byte signature. Returns true if valid.