mirror of
https://github.com/safing/portbase
synced 2025-04-23 18:59:08 +00:00
Move crypto/random to rng
This commit is contained in:
parent
7c9065b8fa
commit
099a597be9
15 changed files with 22 additions and 20 deletions
|
@ -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
9
rng/doc.go
Normal 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
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"time"
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"crypto/aes"
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -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)
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package random
|
||||
package rng
|
||||
|
||||
import (
|
||||
"time"
|
Loading…
Add table
Reference in a new issue