slowseeder

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package slowseeder implements a drop-in replacement for a rand source intended for cryptographic key generation.

It has been designed to be simple and reproducible. Generation is deterministic from a seed, uses multiple layered hashing functions, and is parameterized to easily extend the time spent during each iteration, making brute force and pre-computation more difficult.

Example (GenerateRSA)
r, _ := New([]byte("slowseeder"), 1000, 3, 1024*16, 1)
k, _ := rsa.GenerateKey(r, 2048)
e := pem.EncodeToMemory(&pem.Block{
	Type:  "PRIVATE KEY",
	Bytes: x509.MarshalPKCS1PrivateKey(k),
})
fmt.Println(string(e))
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(seed []byte, rounds, time, memory uint32, threads uint8) (io.Reader, error)

New returns a Reader generator suitable for use with cryptographic functions

Types

type Reader

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

Reader represents a drop in replacement for a rand source

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read implements a Reader that uses SHA512 and RIPEMD160 PBKDF2 to iteratively hash the seed and salt, which are supplied to Argon2 to generate the requested "entropy"

Jump to

Keyboard shortcuts

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