1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

feat: add Md5Byte

This commit is contained in:
dudaodong
2023-06-29 10:33:29 +08:00
parent 16c2df711b
commit 7d56da8108
5 changed files with 85 additions and 16 deletions

View File

@@ -48,6 +48,7 @@ import (
- [HmacSha256](#HmacSha256)
- [HmacSha512](#HmacSha512)
- [Md5String](#Md5String)
- [Md5Byte](#Md5Byte)
- [Md5File](#Md5File)
- [Sha1](#Sha1)
- [Sha256](#Sha256)
@@ -880,6 +881,35 @@ func main() {
}
```
### <span id="Md5Byte">Md5Byte</span>
<p>Return the md5 string of byte slice.</p>
<b>Signature:</b>
```go
func Md5Byte(data []byte) string
```
<b>Example:</b>
```go
package main
import (
"fmt"
"github.com/duke-git/lancet/v2/cryptor"
)
func main() {
md5Str := cryptor.Md5Byte([]byte{'a'})
fmt.Println(md5Str)
// Output:
// 0cc175b9c0f1b6a831c399e269772661
}
```
### <span id="Md5File">Md5File</span>
<p>Get the md5 value of file.</p>

View File

@@ -45,6 +45,7 @@ import (
- [HmacSha256](#HmacSha256)
- [HmacSha512](#HmacSha512)
- [Md5String](#Md5String)
- [Md5Byte](#Md5Byte)
- [Md5File](#Md5File)
- [Sha1](#Sha1)
- [Sha256](#Sha256)
@@ -879,6 +880,35 @@ func main() {
}
```
### <span id="Md5Byte">Md5Byte</span>
<p>获取byte slice的md5至。</p>
<b>函数签名:</b>
```go
func Md5Byte(data []byte) string
```
<b>示例:</b>
```go
package main
import (
"fmt"
"github.com/duke-git/lancet/v2/cryptor"
)
func main() {
md5Str := cryptor.Md5Byte([]byte{'a'})
fmt.Println(md5Str)
// Output:
// 0cc175b9c0f1b6a831c399e269772661
}
```
### <span id="Md5File">Md5File</span>
<p>获取文件md5值。</p>