Skip to main content

Sphincs

Struct Sphincs 

Source
pub struct Sphincs;
Expand description

SPHINCS+-SHAKE256-256f-simple (NIST FIPS 205 / SLH-DSA, security level 5, fast variant).

SPHINCS+ is a stateless hash-based signature scheme. Its security rests solely on the collision resistance and preimage resistance of SHAKE256 — no algebraic structure is assumed. This makes it the most conservative signature scheme available.

The f (fast) variant produces larger signatures than the s (small) variant but signs significantly faster. Verification is fast in both variants.

We are using the “simple” (vs. “robust”) variant of SPHINCS+, which is about 3-4x faster than robust. Robust avoids certain assumptions about SHAKE256 at a significant performance cost. In short, simple assumes something called the “random oracle model”: Hash functions are perfect mathematical objects that perfectly map arbitrary-length inputs to fixed-length pseudorandom outputs.

§Sizes

ObjectBytes
Public key64
Secret key128
Signature49,856

§Pros

  • Minimal trust assumption: security reduces entirely to SHAKE256. Even if all lattice-based schemes were broken tomorrow, SPHINCS+ would be unaffected.
  • Extremely small public and secret keys (64 B / 128 B) — ideal for constrained devices, key pinning, or any context where key storage is at a premium.
  • Stateless: unlike earlier hash-based schemes (XMSS, LMS), no state needs to be maintained between signings, eliminating the risk of catastrophic state reuse.

§Cons

  • Large signatures (~49 KB with the f variant) — unsuitable for protocols that transmit many signatures frequently (e.g. per-packet authentication). Best suited to infrequent, high-value signings such as root CA certificates, firmware releases, or software packages.
  • Signing is slower than ML-DSA, even with the f variant.

Implementations§

Source§

impl Sphincs

Source

pub fn keypair() -> Result<(PublicKey, SecretKey)>

Source

pub fn sign( message: impl AsRef<[u8]>, secret_key: &SecretKey, ) -> Result<Signature>

Source

pub fn verify( message: impl AsRef<[u8]>, signature: &Signature, public_key: &PublicKey, ) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.