]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/md5: add example for Sum
authorChaiShushan <chaishushan@gmail.com>
Mon, 17 Feb 2014 03:33:00 +0000 (14:33 +1100)
committerDave Cheney <dave@cheney.net>
Mon, 17 Feb 2014 03:33:00 +0000 (14:33 +1100)
LGTM=dave
R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/64820044

src/pkg/crypto/md5/example_test.go

index 28be770a7a70948186b09fe6c405a50af48e2e22..e8ecab15f5e6c70f0f60038b3261210dfab7b1f0 100644 (file)
@@ -17,3 +17,9 @@ func ExampleNew() {
        fmt.Printf("%x", h.Sum(nil))
        // Output: e2c569be17396eca2a2e3c11578123ed
 }
+
+func ExampleSum() {
+       input := "The quick brown fox jumps over the lazy dog."
+       fmt.Printf("%x", md5.Sum([]byte(input)))
+       // Output: e4d909c290d0fb1ca068ffaddf22cbd0
+}