Slow deterministic random generator.
Some problems might require random deterministic generator, but this might be problematic due to brute-force attacks. This (deterministic) random generator addresses this problem by increasing it's work time.
Inspired by cornfeedhobo/ssh-keydgen
- Slow
- Deterministic
- Random
- Dependency-free
Go version 1.15+
go get github.com/cristalhq/slowrand
seed := []byte("some-secure-seed")
rounds := 3
time := uint32(5)
memory := uint32(7)
threads := uint8(11)
r, err := slowrand.New(seed, rounds, time, memory, threads)
if err != nil {
t.Fatal(err)
}
var buf [42]byte
n, err := r.Read(buf[:])
if n != 42 {
panic("not 42")
}
_ = err // is always nil
See these docs.