csprng

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(secrets []string) (rand.Source, error)

New returns a Source that can generate uniformly-distributed pseudo-random uint64 values.

The first secret will be the Argon2 salt. Common use cases:

reddit.com my master password
example.com my master password

here the site's name serves as the salt, which appropriately fits the role of the salt (a non-secret value). Argon2 is configured to output 32+16 bytes: 32 bytes for the key, 16 bytes for the IV. In this case (deterministic CSPRNG) the IV isn't important and it could simply be zero.

Types

type SecureSource

type SecureSource struct{ cipher.Stream }

SecureSource contains a `cipher.Stream`.

func (*SecureSource) Int63

func (s *SecureSource) Int63() int64

Int63 generates a (pseudo-)random 63bit value.

func (*SecureSource) Seed

func (s *SecureSource) Seed(seed int64)

Seed panics if invoked

func (*SecureSource) Uint64

func (s *SecureSource) Uint64() uint64

Uint64 generates a (pseudo-)random 64bit value. Uses XORKeyStream with a zero input to extract the raw keystream as 64-bit integers.

Jump to

Keyboard shortcuts

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