github.com/iikira/iikira-go-utils@v0.0.0-20230610031953-f2cb11cde33a/utils/bdcrypto/bdcrypto_test.go (about) 1 package bdcrypto 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestRSAEncryptOfWapBaidu(t *testing.T) { 9 b, _ := RSAEncryptOfWapBaidu(DefaultRSAPublicKeyModulus, []byte("123")) 10 fmt.Println(b) 11 fmt.Println("-------------------") 12 } 13 14 func BenchmarkRSAEncryptOfWapBaidu(b *testing.B) { 15 var by = []byte("Pythonphp123sdif8e83") 16 for i := 0; i < b.N; i++ { 17 RSAEncryptOfWapBaidu(DefaultRSAPublicKeyModulus, by) 18 } 19 } 20 21 func TestBase64(t *testing.T) { 22 var b = []byte("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890") 23 en := Base64Encode(b) 24 fmt.Println(string(en)) 25 de := Base64Decode(en) 26 fmt.Println(string(de)) 27 } 28 29 func TestReverse(t *testing.T) { 30 var b = []byte("1234567890") 31 fmt.Println(string(BytesReverse(b))) 32 } 33 34 func BenchmarkReverse(b *testing.B) { 35 var by = []byte("Pythonphp123sdif8e83") 36 for i := 0; i < b.N; i++ { 37 BytesReverse(by) 38 } 39 }