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.
28 lines
579 B
28 lines
579 B
package crypto
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
var cryptoTool Crypto
|
|
|
|
func TestMd5(tt *testing.T) {
|
|
fmt.Println(cryptoTool.Md5Encode("hello world!"))
|
|
//fc3ff98e8c6a0d3087d515c0473f8677
|
|
fmt.Println(cryptoTool.Md5Check("hello world!", "fc3ff98e8c6a0d3087d515c0473f8677"))
|
|
//true
|
|
|
|
}
|
|
|
|
func TestCrypto_Md5String(t *testing.T) {
|
|
fmt.Println(cryptoTool.Md5String("hello world!"))
|
|
//fc3ff98e8c6a0d3087d515c0473f8677
|
|
}
|
|
|
|
func TestCrypto_Md5EncodeFile(t *testing.T) {
|
|
filePath := "./md5.go"
|
|
fmt.Println(cryptoTool.Md5EncodeFile(filePath))
|
|
//fea07bd54d5c1841a682b408fbbb0cf8 <nil>
|
|
}
|