27 lines
442 B
Go
27 lines
442 B
Go
|
// Copyright 2024 Patial Tech (Ankit Patial).
|
||
|
// All rights reserved.
|
||
|
|
||
|
package crypto
|
||
|
|
||
|
import (
|
||
|
"encoding/base64"
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestRandomBytes(t *testing.T) {
|
||
|
if key, err := RandomBytes(32); err != nil {
|
||
|
t.Error(err)
|
||
|
} else {
|
||
|
fmt.Println(base64.StdEncoding.EncodeToString(key))
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestRandomBytesHex(t *testing.T) {
|
||
|
if key, err := RandomBytesHex(32); err != nil {
|
||
|
t.Error(err)
|
||
|
} else {
|
||
|
fmt.Println(key)
|
||
|
}
|
||
|
}
|