Move crypto/random to rng

This commit is contained in:
Daniel 2019-09-24 15:38:10 +02:00
parent 7c9065b8fa
commit 099a597be9
15 changed files with 22 additions and 20 deletions

View file

@ -1,7 +0,0 @@
// Package random provides a feedable CSPRNG.
//
// CSPRNG used is fortuna: github.com/seehuhn/fortuna
// By default the CSPRNG is fed by two sources:
// - OS RNG
// - Entropy gathered by context switching
package random

9
rng/doc.go Normal file
View file

@ -0,0 +1,9 @@
// Package rng provides a feedable CSPRNG.
//
// CSPRNG used is fortuna: github.com/seehuhn/fortuna
// By default the CSPRNG is fed by two sources:
// - It starts with a seed from `crypto/rand` and periodically reseeds from there
// - A really simple tickfeeder which extracts entropy from the internal go scheduler using goroutines and is meant to be used under load.
//
// The RNG can also be easily fed with additional sources.
package rng

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"encoding/binary"

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"testing"

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"time"

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"testing"

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"encoding/binary"

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"testing"

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"crypto/rand"

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"crypto/aes"

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"testing"

View file

@ -12,7 +12,7 @@ import (
"runtime"
"time"
"github.com/safing/portbase/crypto/random"
"github.com/safing/portbase/rng"
)
func noise() {
@ -55,13 +55,13 @@ func main() {
switch os.Args[1] {
case "fortuna":
err := random.Start()
err := rng.Start()
if err != nil {
panic(err)
}
for {
b, err := random.Bytes(64)
b, err := rng.Bytes(64)
if err != nil {
panic(err)
}

View file

@ -1,4 +1,4 @@
package random
package rng
import (
"time"