1// Copyright 2013 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 5package des_test 6 7import "crypto/des" 8 9func ExampleNewTripleDESCipher() { 10 // NewTripleDESCipher can also be used when EDE2 is required by 11 // duplicating the first 8 bytes of the 16-byte key. 12 ede2Key := []byte("example key 1234") 13 14 var tripleDESKey []byte 15 tripleDESKey = append(tripleDESKey, ede2Key[:16]...) 16 tripleDESKey = append(tripleDESKey, ede2Key[:8]...) 17 18 _, err := des.NewTripleDESCipher(tripleDESKey) 19 if err != nil { 20 panic(err) 21 } 22 23 // See crypto/cipher for how to use a cipher.Block for encryption and 24 // decryption. 25} 26