SPHINCS_golang

package module
v0.0.0-...-9ff798e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

SPHINCS-golang

SPHINCS: practical stateless hash-based signatures

Daniel J. Bernstein, Daira Hopwood, Andreas Hülsing, Tanja Lange, Ruben Niederhagen, Louiza Papachristodoulou, Peter Schwabe, Zooko Wilcox-O'Hearn. SPHINCS: practical stateless hash-based signatures.

Documentation

Index

Constants

View Source
const (
	SUBTREE_HEIGHT   = 5
	TOTALTREE_HEIGHT = 60
	N_LEVELS         = (TOTALTREE_HEIGHT / SUBTREE_HEIGHT)
	SEED_BYTES       = 32
	WOTS_LOGW        = 4
	WOTS_LogL        = 7
	WOTS_SIGBYTES    = (WOTS_L * HASH_BYTES)

	SK_RAND_SEED_BYTES      = 32
	MESSAGE_HASH_SEED_BYTES = 32

	HORST_LOGT     = 16
	HORST_T        = (1 << HORST_LOGT)
	HORST_K        = 32
	HORST_SKBYTES  = 32
	HORST_SIGBYTES = (64*HASH_BYTES + (((HORST_LOGT-6)*HASH_BYTES)+HORST_SKBYTES)*HORST_K)

	WOTS_W        = (1 << WOTS_LOGW)
	WOTS_L1       = ((256 + WOTS_LOGW - 1) / WOTS_LOGW)
	WOTS_L        = 67 // for WOTS_W == 16
	WOTS_SIGBYTES = (WOTS_L * HASH_BYTES)
	HASHSIZE      = blake256.Size

	HASH_BYTES    = 32 // Has to be log(HORST_T)*HORST_K/8
	MSGHASH_BYTES = 64
	HASHC         = "expand 32-byte to 64-byte state!"
	SIGMA         = "expand 32-byte k"
	TAU           = "expand 16-byte k"
	CHACHAROUNDS  = 12
	N_MASKS       = (2 * (HORST_LOGT))
)
View Source
const (
	// PublicKeySize is the length of a SPHINCS-256 public key in bytes.
	PublicKeySize = (nMasks + 1) * HASHSIZE

	// PrivateKeySize is the length of a SPHINCS-256 private key in bytes.
	PrivateKeySize = seedBytes + PublicKeySize - HASHSIZE + skRandSeedBytes

	// SignatureSize is the length of a SPHINCS-256 signature in bytes.
	SignatureSize = messageHashSeedBytes + (TOTALTREE_HEIGHT+7)/8 + HORST_SIGBYTES + (TOTALTREE_HEIGHT/subtreeHeight)*WOTS_SIGBYTES + TOTALTREE_HEIGHT*HASHSIZE
)

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(rand io.Reader) (publicKey *[PublicKeySize]byte, privateKey *[PrivateKeySize]byte, err error)

GenerateKey generates a public/private key pair using randomness from rand.

func Hash_2n_n

func Hash_2n_n(out, in []byte)

func Hash_2n_n_mask

func Hash_2n_n_mask(out, in, mask []byte)

func Hash_n_n

func Hash_n_n(out, in []byte)

func Hash_n_n_mask

func Hash_n_n_mask(out, in, mask []byte)

func Open

func Open(publicKey *[PublicKeySize]byte, message []byte) (body []byte, err error)

Open takes a signed message and public key and returns the message if the signature is valid.

func Sign

func Sign(sig []byte, msg *[HASHSIZE]byte, sk *[SEED_BYTES]byte, masks []byte)

func SignData

func SignData(privateKey *[PrivateKeySize]byte, message []byte) *[SignatureSize]byte

Sign signs the message with privateKey and returns the signature.

func Varlen

func Varlen(out, in []byte)

func Verify

func Verify(pk, sig, m, masks, mHash []byte) int

func VerifyData

func VerifyData(publicKey *[PublicKeySize]byte, message []byte, signature *[SignatureSize]byte) bool

Verify takes a public key, message and signature and returns true if the signature is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址