From 9e72f6f23f256b8aea896e34d5c264a32bde1c5d Mon Sep 17 00:00:00 2001 From: leexsoft-mac Date: Wed, 16 Oct 2019 12:16:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0md5=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- encrypt/md5.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 encrypt/md5.go diff --git a/.gitignore b/.gitignore index c14a297..e1d8bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -go.sum \ No newline at end of file +go.sum +.vscode \ No newline at end of file diff --git a/encrypt/md5.go b/encrypt/md5.go new file mode 100644 index 0000000..1b188fc --- /dev/null +++ b/encrypt/md5.go @@ -0,0 +1,14 @@ +package encrypt + +import ( + "crypto/md5" + "encoding/hex" +) + +// MD5算法 +func MD5(plainText string) string { + hash := md5.New() + hash.Write([]byte(plainText)) + hashSign := hash.Sum(nil) + return hex.EncodeToString(hashSign) +} -- Gitee From 8ba757705cab2c915182fa6e0331d0e6a8b65eaa Mon Sep 17 00:00:00 2001 From: leexsoft-mac Date: Wed, 16 Oct 2019 12:26:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?readme=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e897887..f19e58a 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ * [AesCbcPkcs5Encrypt](encrypt/aes.go):AES/CBC/PKCS5模式加密。 * [AesCbcPkcs5Decrypt](encrypt/aes.go):AES/CBC/PKCS5模式解密。 * [SHA1](encrypt/sha.go):SHA1算法。 +* [MD5](encrypt/md5.go):MD5算法。 ### 文件系统(filesystem) -- Gitee