You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
958 B
25 lines
958 B
package crypto
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestShaEncode(t *testing.T) {
|
|
fmt.Println(cryptoTool.Sha256Encode("hello world!"))
|
|
//7509e5bda0c762d2bac7f90d758b5b2263fa01ccbc542ab5e3df163be08e6ca9
|
|
fmt.Println(cryptoTool.Sha1Encode("hello world!"))
|
|
//430ce34d020724ed75a196dfc2ad67c77772d169
|
|
fmt.Println(cryptoTool.Sha512Encode("hello world!"))
|
|
//db9b1cd3262dee37756a09b9064973589847caa8e53d31a9d142ea2701b1b28abd97838bb9a27068ba305dc8d04a45a1fcf079de54d607666996b3cc54f6b67c
|
|
}
|
|
|
|
func TestCrypto_ShaHmac(t *testing.T) {
|
|
fmt.Println(cryptoTool.Sha1Hmac("hello world!", "123456"))
|
|
//397d14b5c064f1f3a19c2e8d1f5108d797a47a3c
|
|
fmt.Println(cryptoTool.Sha256Hmac("hello world!", "123456"))
|
|
//03c6198ea823af32c338b1524d1653ccc065c06af916495a178208189555d428
|
|
fmt.Println(cryptoTool.Sha512Hmac("hello world!", "123456"))
|
|
//8a432b00e63bbca7fe42d75d2517724af89f0d5404b42b828adbbcb87b1916e73c3a4186adab399ba636aee431ee35a238e75e87f29583189ca1502d3da9885e
|
|
}
|