crypto

package
v0.0.0-...-11acf48 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2018 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package crypto contains the cryptographic routines for CONIKS: hashing, cryptographic commitments, digital signatures, VRF, and random number generation.

These cryptographic routines are used to:

- hash arbitrary data (Digest) using SHA3 (SHAKE128),

- create a cryptographic commit to arbitrary data,

- generate a random slice of bytes,

- sign data and verify signatures using Ed25519,

- apply a VRF to data and verify the VRF proof.

Index

Constants

View Source
const (
	// HashSizeByte is the size of the hash output in bytes.
	HashSizeByte = 32
	// HashID identifies the used hash as a string.
	HashID = "SHAKE128"
)

Variables

This section is empty.

Functions

func Digest

func Digest(ms ...[]byte) []byte

Digest hashes all passed byte slices. The passed slices won't be mutated.

func MakeRand

func MakeRand() ([]byte, error)

MakeRand returns a random slice of bytes. It returns an error if there was a problem while generating the random slice. It is different from the 'standard' random byte generation as it hashes its output before returning it; by hashing the system's PRNG output before it is send over the wire, we aim to make the random output less predictable (even if the system's PRNG isn't as unpredictable as desired). See https://trac.torproject.org/projects/tor/ticket/17694

func NewStaticTestSigningKey

func NewStaticTestSigningKey() sign.PrivateKey

NewStaticTestSigningKey returns a static private signing key for _tests_.

func NewStaticTestVRFKey

func NewStaticTestVRFKey() vrf.PrivateKey

NewStaticTestVRFKey returns a static VRF private key for _tests_.

Types

type Commit

type Commit struct {
	// Salt is a cryptographic salt which will be hashed in addition
	// to the value.
	Salt []byte
	// Value is the actual value to commit to.
	Value []byte
}

Commit can be used to create a cryptographic commit to some value (use NewCommit() for this purpose.

func NewCommit

func NewCommit(stuff ...[]byte) (*Commit, error)

NewCommit creates a new cryptographic commit to the passed byte slices stuff (which won't be mutated). It creates a random salt before committing to the values.

func (*Commit) Verify

func (c *Commit) Verify(stuff ...[]byte) bool

Verify verifies that the underlying commit c was a commit to the passed byte slices stuff (which won't be mutated).

Directories

Path Synopsis
internal
ed25519/edwards25519
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519.
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519.
Package sign implements a digital signature scheme using the Edwards form of Curve25519.
Package sign implements a digital signature scheme using the Edwards form of Curve25519.
Package vrf implements a verifiable random function using the Edwards form of Curve25519, SHA3 and the Elligator map.
Package vrf implements a verifiable random function using the Edwards form of Curve25519, SHA3 and the Elligator map.

Jump to

Keyboard shortcuts

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