iedc-go/vendor/github.com/chanxuehong/rand/helper.go
2023-03-03 03:12:15 +08:00

25 lines
532 B
Go

package rand
import "encoding/hex"
// New returns 16 random bytes.
//
// The result is not printable, you can use encoding/hex or encoding/base64 to print it.
//
// Deprecated: Please use the Read function directly.
func New() (result [16]byte) {
Read(result[:])
return
}
// NewHex returns 32 hex-encoded random bytes.
//
// Deprecated: Please use the Read function directly.
func NewHex() (result []byte) {
var buf [16]byte
Read(buf[:])
result = make([]byte, hex.EncodedLen(len(buf)))
hex.Encode(result, buf[:])
return
}