util

package
v0.0.0-...-208edab Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2016 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const HashOutputLen = 32

HashOutputLen is the number of bytes of output from SHA-512 to use.

View Source
const SigningKeyLen = 64

SigningKeyLen is the length in bytes of the signing key.

View Source
const VerificationKeyLen = 32

VerificationKeyLen is the length in bytes of the verification key.

Variables

This section is empty.

Functions

func Btoi

func Btoi(i []byte) (r int)

Btoi converts a byte slice into an integer. WARNING, only use on known valid input (produced by Itob).

func Equal

func Equal(x, y []byte) bool

Equal compares two byte slices in constant time.

func GenerateSigningKeyPair

func GenerateSigningKeyPair() (sk, vk []byte, err error)

GenerateSigningKeyPair attempts to generate a signature key-pair.

func Hash

func Hash(data ...[]byte) []byte

Hash hashes the provided data with SHA-512 (first HashOutputLen-byte output size). We use SHA-512 with the first 256 bits as output instead of SHA512/256 due to better compatability with NaCl.

func Itob

func Itob(i int) (r []byte)

Itob converts an integer into a byte slice.

func Pow

func Pow(a, b int) int

Pow returns a^b.

func Sign

func Sign(sk, message []byte) (signature []byte, err error)

Sign attempts to sign a a message with a provideded key.

func ToByteArray32

func ToByteArray32(s []byte) (*[32]byte, error)

ToByteArray32 attempts to convert a slice into a 32-byte arrray.

func ToByteArray64

func ToByteArray64(s []byte) (*[64]byte, error)

ToByteArray64 attempts to convert a slice into a 64-byte arrray.

func Verify

func Verify(vk, message []byte, signature []byte) bool

Verify attempts to verify a signature on a message with a key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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