Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package nodeutils
import (
"github.com/iwind/TeaGo/maps"
"testing"
)
func TestEncryptMap(t *testing.T) {
e, err := EncryptMap("a", "b", maps.Map{
"c": 1,
}, 5)
if err != nil {
t.Fatal(err)
}
t.Log("e:", e)
s, err := DecryptMap("a", "b", e)
if err != nil {
t.Fatal(err)
}
t.Log("s:", s)
}
func TestEncryptData(t *testing.T) {
encoded, err := EncryptData("a", "b", []byte("Hello, World"))
if err != nil {
t.Fatal(err)
}
t.Log("encoded:", encoded)
source, err := DecryptData("a", "b", encoded)
if err != nil {
t.Fatal(err)
}
t.Log("source:", string(source))
}
func BenchmarkEncryptData(b *testing.B) {
for i := 0; i < b.N; i++ {
_, _ = EncryptMap("a", "b", maps.Map{
"c": 1,
}, 5)
}
}