22 lines
299 B
Go
22 lines
299 B
Go
package kvstore
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/hex"
|
|
mrand "math/rand"
|
|
)
|
|
|
|
func _b(in string) []byte {
|
|
return []byte(in)
|
|
}
|
|
|
|
func randString() string {
|
|
buf := make([]byte, 1+mrand.Intn(20))
|
|
rand.Read(buf)
|
|
return hex.EncodeToString(buf)
|
|
}
|
|
|
|
func randBytes() []byte {
|
|
return _b(randString())
|
|
}
|