Documentation
¶
Index ¶
- Constants
- func GenerateKey(rand io.Reader) (publicKey *[PublicKeySize]byte, privateKey *[PrivateKeySize]byte, err error)
- func Hash_2n_n(out, in []byte)
- func Hash_2n_n_mask(out, in, mask []byte)
- func Hash_n_n(out, in []byte)
- func Hash_n_n_mask(out, in, mask []byte)
- func Open(publicKey *[PublicKeySize]byte, message []byte) (body []byte, err error)
- func Sign(sig []byte, msg *[HASHSIZE]byte, sk *[SEED_BYTES]byte, masks []byte)
- func SignData(privateKey *[PrivateKeySize]byte, message []byte) *[SignatureSize]byte
- func Varlen(out, in []byte)
- func Verify(pk, sig, m, masks, mHash []byte) int
- func VerifyData(publicKey *[PublicKeySize]byte, message []byte, signature *[SignatureSize]byte) bool
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_mask ¶
func Hash_2n_n_mask(out, in, mask []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 SignData ¶
func SignData(privateKey *[PrivateKeySize]byte, message []byte) *[SignatureSize]byte
Sign signs the message with privateKey and returns the signature.
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.
Click to show internal directories.
Click to hide internal directories.