syncrand

package module
v0.0.0-...-ca56296 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2022 License: LGPL-3.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commit

func Commit(nonce []byte) []byte

Commit computes a 128-bit commitment of a nonce to send to the remote.

func MakeSeed

func MakeSeed(nonces ...[]byte) []byte

MakeSeed combines nonces into a seed appropriate to pass to NewRand. All nonces must be of the same length.

func Verify

func Verify(ourCommitment []byte, theirCommitment []byte, theirNonce []byte) bool

Verify verifies that their commitment matches their nonce, and also their commitment is not the same as our commitment.

Types

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source is a rand.Source compatible random number generator.

func NewSource

func NewSource(seed []byte) *Source

NewRand creates a new random number generator with the given seed.

func (*Source) Clone

func (r *Source) Clone() *Source

Clone clones this random number generator.

func (*Source) Int63

func (r *Source) Int63() int64

Int63 implements Source.Int63.

func (*Source) Seed

func (r *Source) Seed(seed int64)

Seed is not supported: you must create a new Source to reseed.

func (*Source) SeedOffset

func (r *Source) SeedOffset() uint

SeedOffset returns how many times Int63 has been called on this random number generator.

Jump to

Keyboard shortcuts

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