Skip to content

Commit

Permalink
add crypto/md5 example
Browse files Browse the repository at this point in the history
官网的例子
  • Loading branch information
Zhanming Qi committed Mar 26, 2013
1 parent 26fdc8c commit 360a582
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
15 changes: 15 additions & 0 deletions crypto/md5/Constants.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## const BlockSize = 64

功能说明:

The blocksize of MD5 in bytes.
MD5的数据块的字节长度为64字节。

## const Size = 16

功能说明:

The size of an MD5 checksum in bytes.
MD5的校验和的字节长度为16字节。

具体使用参见[func New() hash.Hash](New.md)
34 changes: 34 additions & 0 deletions crypto/md5/New.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## func New() hash.Hash

参数列表

-

返回值:

- 返回hash.Hash类型

功能说明:

New returns a new hash.Hash computing the MD5 checksum.
New方法返回一个hash.Hash类型,用于计算MD5的校验和。

代码实例:

package main

import (
"crypto/md5"
"fmt"
"io"
)

// 官网的例子:http://golang.org/pkg/crypto/md5/
func main() {
h := md5.New()
io.WriteString(h, "The fog is getting thicker!")
io.WriteString(h, "And Leon's getting laaarger!")
fmt.Printf("%x", h.Sum(nil))
}
// e2c569be17396eca2a2e3c11578123ed

8 changes: 3 additions & 5 deletions crypto/md5/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# 包名
# crypto/md5包函数列表

函数列表

- xxx1
- xxx2
- [Constants](Constants.md)
- [func New() hash.Hash](New.md)

0 comments on commit 360a582

Please sign in to comment.