iedc-go/vendor/github.com/chanxuehong/rand/helper.go

25 lines
532 B
Go
Raw Normal View History

2023-03-02 19:12:15 +00:00
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
}