}
}
-func ExampleNewTripleDESCipher() {
- // NewTripleDESCipher can also be used when EDE2 is required by
- // duplicating the first 8 bytes of the 16-byte key.
- ede2Key := []byte("example key 1234")
-
- var tripleDESKey []byte
- tripleDESKey = append(tripleDESKey, ede2Key[:16]...)
- tripleDESKey = append(tripleDESKey, ede2Key[:8]...)
-
- _, err := NewTripleDESCipher(tripleDESKey)
- if err != nil {
- panic(err)
- }
-
- // See crypto/cipher for how to use a cipher.Block for encryption and
- // decryption.
-}
-
func BenchmarkEncrypt(b *testing.B) {
tt := encryptDESTests[0]
c, err := NewCipher(tt.key)
--- /dev/null
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package des_test
+
+import "crypto/des"
+
+func ExampleNewTripleDESCipher() {
+ // NewTripleDESCipher can also be used when EDE2 is required by
+ // duplicating the first 8 bytes of the 16-byte key.
+ ede2Key := []byte("example key 1234")
+
+ var tripleDESKey []byte
+ tripleDESKey = append(tripleDESKey, ede2Key[:16]...)
+ tripleDESKey = append(tripleDESKey, ede2Key[:8]...)
+
+ _, err := des.NewTripleDESCipher(tripleDESKey)
+ if err != nil {
+ panic(err)
+ }
+
+ // See crypto/cipher for how to use a cipher.Block for encryption and
+ // decryption.
+}
--- /dev/null
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package md5_test
+
+import (
+ "crypto/md5"
+ "fmt"
+ "io"
+)
+
+func ExampleNew() {
+ 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))
+ // Output: e2c569be17396eca2a2e3c11578123ed
+}
}
}
-func ExampleNew() {
- h := New()
- io.WriteString(h, "The fog is getting thicker!")
- io.WriteString(h, "And Leon's getting laaarger!")
- fmt.Printf("%x", h.Sum(nil))
- // Output: e2c569be17396eca2a2e3c11578123ed
-}
-
var bench = New()
var buf = make([]byte, 8192+1)
var sum = make([]byte, bench.Size())
--- /dev/null
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package sha1_test
+
+import (
+ "crypto/sha1"
+ "fmt"
+ "io"
+)
+
+func ExampleNew() {
+ h := sha1.New()
+ io.WriteString(h, "His money is twice tainted: 'taint yours and 'taint mine.")
+ fmt.Printf("% x", h.Sum(nil))
+ // Output: 59 7f 6a 54 00 10 f9 4c 15 d7 18 06 a9 9a 2c 87 10 e7 47 bd
+}
}
}
-func ExampleNew() {
- h := New()
- io.WriteString(h, "His money is twice tainted: 'taint yours and 'taint mine.")
- fmt.Printf("% x", h.Sum(nil))
- // Output: 59 7f 6a 54 00 10 f9 4c 15 d7 18 06 a9 9a 2c 87 10 e7 47 bd
-}
-
var bench = New()
var buf = make([]byte, 8192)