slowseeder

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

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

Go to latest
Published: Feb 18, 2020 License: MIT Imports: 7 Imported by: 0

README

go-slowseeder Go Report Card

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

It has been designed to be simple to comprehend. 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.

Contributing

This project could use some tests. PRs are welcome.

Limitations

The way golang consumes entropy while performing cryptographic functions is subject to change at any time. Normally this wouldn't matter, but because this creates a deterministic stream, the final product will change as well.

Is it any good

Yes

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 to comprehend. 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 configured Reader

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