appcore/crypto/random_test.go

29 lines
539 B
Go
Raw Permalink Normal View History

2025-06-16 22:19:00 +05:30
// Copyright 2024 Patial Tech (Ankit Patial).
2025-06-16 22:26:47 +05:30
//
// This file is part of code.patial.tech/go/appcore, which is MIT licensed.
// See http://opensource.org/licenses/MIT
2025-06-16 22:19:00 +05:30
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)
}
}