OSDN Git Service

add package
[bytom/vapor.git] / vendor / github.com / libp2p / go-libp2p-crypto / test / utils.go
1 package testutil
2
3 import (
4         "math/rand"
5         "time"
6
7         ci "github.com/libp2p/go-libp2p-crypto"
8 )
9
10 func RandTestKeyPair(typ, bits int) (ci.PrivKey, ci.PubKey, error) {
11         return SeededTestKeyPair(typ, bits, time.Now().UnixNano())
12 }
13
14 func SeededTestKeyPair(typ, bits int, seed int64) (ci.PrivKey, ci.PubKey, error) {
15         r := rand.New(rand.NewSource(seed))
16         return ci.GenerateKeyPairWithReader(typ, bits, r)
17 }