github.com/shijuvar/go@v0.0.0-20141209052335-e8f13700b70c/src/crypto/sha1/example_test.go (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package sha1_test
     6  
     7  import (
     8  	"crypto/sha1"
     9  	"fmt"
    10  	"io"
    11  )
    12  
    13  func ExampleNew() {
    14  	h := sha1.New()
    15  	io.WriteString(h, "His money is twice tainted:")
    16  	io.WriteString(h, " 'taint yours and 'taint mine.")
    17  	fmt.Printf("% x", h.Sum(nil))
    18  	// Output: 59 7f 6a 54 00 10 f9 4c 15 d7 18 06 a9 9a 2c 87 10 e7 47 bd
    19  }
    20  
    21  func ExampleSum() {
    22  	data := []byte("This page intentionally left blank.")
    23  	fmt.Printf("% x", sha1.Sum(data))
    24  	// Output: af 06 49 23 bb f2 30 15 96 aa c4 c2 73 ba 32 17 8e bc 4a 96
    25  }