...

Source file src/crypto/des/des_test.go

Documentation: crypto/des

		 1  // Copyright 2011 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 des
		 6  
		 7  import (
		 8  	"bytes"
		 9  	"testing"
		10  )
		11  
		12  type CryptTest struct {
		13  	key []byte
		14  	in	[]byte
		15  	out []byte
		16  }
		17  
		18  // some custom tests for DES
		19  var encryptDESTests = []CryptTest{
		20  	{
		21  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		22  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		23  		[]byte{0x8c, 0xa6, 0x4d, 0xe9, 0xc1, 0xb1, 0x23, 0xa7}},
		24  	{
		25  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		26  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
		27  		[]byte{0x35, 0x55, 0x50, 0xb2, 0x15, 0x0e, 0x24, 0x51}},
		28  	{
		29  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		30  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		31  		[]byte{0x61, 0x7b, 0x3a, 0x0c, 0xe8, 0xf0, 0x71, 0x00}},
		32  	{
		33  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		34  		[]byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
		35  		[]byte{0x92, 0x31, 0xf2, 0x36, 0xff, 0x9a, 0xa9, 0x5c}},
		36  	{
		37  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
		38  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		39  		[]byte{0xca, 0xaa, 0xaf, 0x4d, 0xea, 0xf1, 0xdb, 0xae}},
		40  	{
		41  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
		42  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
		43  		[]byte{0x73, 0x59, 0xb2, 0x16, 0x3e, 0x4e, 0xdc, 0x58}},
		44  	{
		45  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
		46  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		47  		[]byte{0x6d, 0xce, 0x0d, 0xc9, 0x00, 0x65, 0x56, 0xa3}},
		48  	{
		49  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
		50  		[]byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
		51  		[]byte{0x9e, 0x84, 0xc5, 0xf3, 0x17, 0x0f, 0x8e, 0xff}},
		52  	{
		53  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		54  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		55  		[]byte{0xd5, 0xd4, 0x4f, 0xf7, 0x20, 0x68, 0x3d, 0x0d}},
		56  	{
		57  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		58  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
		59  		[]byte{0x59, 0x73, 0x23, 0x56, 0xf3, 0x6f, 0xde, 0x06}},
		60  	{
		61  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		62  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		63  		[]byte{0x56, 0xcc, 0x09, 0xe7, 0xcf, 0xdc, 0x4c, 0xef}},
		64  	{
		65  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		66  		[]byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
		67  		[]byte{0x12, 0xc6, 0x26, 0xaf, 0x05, 0x8b, 0x43, 0x3b}},
		68  	{
		69  		[]byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
		70  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
		71  		[]byte{0xa6, 0x8c, 0xdc, 0xa9, 0x0c, 0x90, 0x21, 0xf9}},
		72  	{
		73  		[]byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
		74  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
		75  		[]byte{0x2a, 0x2b, 0xb0, 0x08, 0xdf, 0x97, 0xc2, 0xf2}},
		76  	{
		77  		[]byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
		78  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		79  		[]byte{0xed, 0x39, 0xd9, 0x50, 0xfa, 0x74, 0xbc, 0xc4}},
		80  	{
		81  		[]byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
		82  		[]byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
		83  		[]byte{0xa9, 0x33, 0xf6, 0x18, 0x30, 0x23, 0xb3, 0x10}},
		84  	{
		85  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		86  		[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
		87  		[]byte{0x17, 0x66, 0x8d, 0xfc, 0x72, 0x92, 0x53, 0x2d}},
		88  	{
		89  		[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
		90  		[]byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
		91  		[]byte{0xb4, 0xfd, 0x23, 0x16, 0x47, 0xa5, 0xbe, 0xc0}},
		92  	{
		93  		[]byte{0x0e, 0x32, 0x92, 0x32, 0xea, 0x6d, 0x0d, 0x73},
		94  		[]byte{0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87},
		95  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
		96  	{
		97  		[]byte{0x73, 0x65, 0x63, 0x52, 0x33, 0x74, 0x24, 0x3b}, // "secR3t$;"
		98  		[]byte{0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x31, 0x32}, // "a test12"
		99  		[]byte{0x37, 0x0d, 0xee, 0x2c, 0x1f, 0xb4, 0xf7, 0xa5}},
	 100  	{
	 101  		[]byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh"
	 102  		[]byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh"
	 103  		[]byte{0x2a, 0x8d, 0x69, 0xde, 0x9d, 0x5f, 0xdf, 0xf9}},
	 104  	{
	 105  		[]byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh"
	 106  		[]byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678"
	 107  		[]byte{0x21, 0xc6, 0x0d, 0xa5, 0x34, 0x24, 0x8b, 0xce}},
	 108  	{
	 109  		[]byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678"
	 110  		[]byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh"
	 111  		[]byte{0x94, 0xd4, 0x43, 0x6b, 0xc3, 0xb5, 0xb6, 0x93}},
	 112  	{
	 113  		[]byte{0x1f, 0x79, 0x90, 0x5f, 0x88, 0x01, 0xc8, 0x88}, // random
	 114  		[]byte{0xc7, 0x46, 0x18, 0x73, 0xaf, 0x48, 0x5f, 0xb3}, // random
	 115  		[]byte{0xb0, 0x93, 0x50, 0x88, 0xf9, 0x92, 0x44, 0x6a}},
	 116  	{
	 117  		[]byte{0xe6, 0xf4, 0xf2, 0xdb, 0x31, 0x42, 0x53, 0x01}, // random
	 118  		[]byte{0xff, 0x3d, 0x25, 0x50, 0x12, 0xe3, 0x4a, 0xc5}, // random
	 119  		[]byte{0x86, 0x08, 0xd3, 0xd1, 0x6c, 0x2f, 0xd2, 0x55}},
	 120  	{
	 121  		[]byte{0x69, 0xc1, 0x9d, 0xc1, 0x15, 0xc5, 0xfb, 0x2b}, // random
	 122  		[]byte{0x1a, 0x22, 0x5c, 0xaf, 0x1f, 0x1d, 0xa3, 0xf9}, // random
	 123  		[]byte{0x64, 0xba, 0x31, 0x67, 0x56, 0x91, 0x1e, 0xa7}},
	 124  	{
	 125  		[]byte{0x6e, 0x5e, 0xe2, 0x47, 0xc4, 0xbf, 0xf6, 0x51}, // random
	 126  		[]byte{0x11, 0xc9, 0x57, 0xff, 0x66, 0x89, 0x0e, 0xf0}, // random
	 127  		[]byte{0x94, 0xc5, 0x35, 0xb2, 0xc5, 0x8b, 0x39, 0x72}},
	 128  }
	 129  
	 130  var weakKeyTests = []CryptTest{
	 131  	{
	 132  		[]byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 133  		[]byte{0x55, 0x74, 0xc0, 0xbd, 0x7c, 0xdf, 0xf7, 0x39}, // random
	 134  		nil},
	 135  	{
	 136  		[]byte{0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe},
	 137  		[]byte{0xe8, 0xe1, 0xa7, 0xc1, 0xde, 0x11, 0x89, 0xaa}, // random
	 138  		nil},
	 139  	{
	 140  		[]byte{0xe0, 0xe0, 0xe0, 0xe0, 0xf1, 0xf1, 0xf1, 0xf1},
	 141  		[]byte{0x50, 0x6a, 0x4b, 0x94, 0x3b, 0xed, 0x7d, 0xdc}, // random
	 142  		nil},
	 143  	{
	 144  		[]byte{0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e},
	 145  		[]byte{0x88, 0x81, 0x56, 0x38, 0xec, 0x3b, 0x1c, 0x97}, // random
	 146  		nil},
	 147  	{
	 148  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 149  		[]byte{0x17, 0xa0, 0x83, 0x62, 0x32, 0xfe, 0x9a, 0x0b}, // random
	 150  		nil},
	 151  	{
	 152  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
	 153  		[]byte{0xca, 0x8f, 0xca, 0x1f, 0x50, 0xc5, 0x7b, 0x49}, // random
	 154  		nil},
	 155  	{
	 156  		[]byte{0xe1, 0xe1, 0xe1, 0xe1, 0xf0, 0xf0, 0xf0, 0xf0},
	 157  		[]byte{0xb1, 0xea, 0xad, 0x7d, 0xe7, 0xc3, 0x7a, 0x43}, // random
	 158  		nil},
	 159  	{
	 160  		[]byte{0x1e, 0x1e, 0x1e, 0x1e, 0x0f, 0x0f, 0x0f, 0x0f},
	 161  		[]byte{0xae, 0x74, 0x7d, 0x6f, 0xef, 0x16, 0xbb, 0x81}, // random
	 162  		nil},
	 163  }
	 164  
	 165  var semiWeakKeyTests = []CryptTest{
	 166  	// key and out contain the semi-weak key pair
	 167  	{
	 168  		[]byte{0x01, 0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e},
	 169  		[]byte{0x12, 0xfa, 0x31, 0x16, 0xf9, 0xc5, 0x0a, 0xe4}, // random
	 170  		[]byte{0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e, 0x01}},
	 171  	{
	 172  		[]byte{0x01, 0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1},
	 173  		[]byte{0xb0, 0x4c, 0x7a, 0xee, 0xd2, 0xe5, 0x4d, 0xb7}, // random
	 174  		[]byte{0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1, 0x01}},
	 175  	{
	 176  		[]byte{0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe},
	 177  		[]byte{0xa4, 0x81, 0xcd, 0xb1, 0x64, 0x6f, 0xd3, 0xbc}, // random
	 178  		[]byte{0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01}},
	 179  	{
	 180  		[]byte{0x1f, 0xe0, 0x1f, 0xe0, 0x0e, 0xf1, 0x0e, 0xf1},
	 181  		[]byte{0xee, 0x27, 0xdd, 0x88, 0x4c, 0x22, 0xcd, 0xce}, // random
	 182  		[]byte{0xe0, 0x1f, 0xe0, 0x1f, 0xf1, 0x0e, 0xf1, 0x0e}},
	 183  	{
	 184  		[]byte{0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe},
	 185  		[]byte{0x19, 0x3d, 0xcf, 0x97, 0x70, 0xfb, 0xab, 0xe1}, // random
	 186  		[]byte{0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e}},
	 187  	{
	 188  		[]byte{0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1, 0xfe},
	 189  		[]byte{0x7c, 0x82, 0x69, 0xe4, 0x1e, 0x86, 0x99, 0xd7}, // random
	 190  		[]byte{0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1}},
	 191  }
	 192  
	 193  // some custom tests for TripleDES
	 194  var encryptTripleDESTests = []CryptTest{
	 195  	{
	 196  		[]byte{
	 197  			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	 198  			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	 199  			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 200  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 201  		[]byte{0x92, 0x95, 0xb5, 0x9b, 0xb3, 0x84, 0x73, 0x6e}},
	 202  	{
	 203  		[]byte{
	 204  			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	 205  			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	 206  			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 207  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
	 208  		[]byte{0xc1, 0x97, 0xf5, 0x58, 0x74, 0x8a, 0x20, 0xe7}},
	 209  	{
	 210  		[]byte{
	 211  			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	 212  			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	 213  			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
	 214  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 215  		[]byte{0x3e, 0x68, 0x0a, 0xa7, 0x8b, 0x75, 0xdf, 0x18}},
	 216  	{
	 217  		[]byte{
	 218  			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	 219  			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	 220  			0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
	 221  		[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
	 222  		[]byte{0x6d, 0x6a, 0x4a, 0x64, 0x4c, 0x7b, 0x8c, 0x91}},
	 223  	{
	 224  		[]byte{ // "abcdefgh12345678ABCDEFGH"
	 225  			0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
	 226  			0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
	 227  			0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48},
	 228  		[]byte{0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30}, // "00000000"
	 229  		[]byte{0xe4, 0x61, 0xb7, 0x59, 0x68, 0x8b, 0xff, 0x66}},
	 230  	{
	 231  		[]byte{ // "abcdefgh12345678ABCDEFGH"
	 232  			0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
	 233  			0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
	 234  			0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48},
	 235  		[]byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678"
	 236  		[]byte{0xdb, 0xd0, 0x92, 0xde, 0xf8, 0x34, 0xff, 0x58}},
	 237  	{
	 238  		[]byte{ // "abcdefgh12345678ABCDEFGH"
	 239  			0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
	 240  			0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
	 241  			0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48},
	 242  		[]byte{0xf0, 0xc5, 0x82, 0x22, 0xd3, 0xe6, 0x12, 0xd2}, // random
	 243  		[]byte{0xba, 0xe4, 0x41, 0xb1, 0x3c, 0x37, 0x4d, 0xf4}},
	 244  	{
	 245  		[]byte{ // random
	 246  			0xd3, 0x7d, 0x45, 0xee, 0x22, 0xe9, 0xcf, 0x52,
	 247  			0xf4, 0x65, 0xa2, 0x4f, 0x70, 0xd1, 0x81, 0x8a,
	 248  			0x3d, 0xbe, 0x2f, 0x39, 0xc7, 0x71, 0xd2, 0xe9},
	 249  		[]byte{0x49, 0x53, 0xc3, 0xe9, 0x78, 0xdf, 0x9f, 0xaf}, // random
	 250  		[]byte{0x53, 0x40, 0x51, 0x24, 0xd8, 0x3c, 0xf9, 0x88}},
	 251  	{
	 252  		[]byte{ // random
	 253  			0xcb, 0x10, 0x7d, 0xda, 0x7e, 0x96, 0x57, 0x0a,
	 254  			0xe8, 0xeb, 0xe8, 0x07, 0x8e, 0x87, 0xd3, 0x57,
	 255  			0xb2, 0x61, 0x12, 0xb8, 0x2a, 0x90, 0xb7, 0x2f},
	 256  		[]byte{0xa3, 0xc2, 0x60, 0xb1, 0x0b, 0xb7, 0x28, 0x6e}, // random
	 257  		[]byte{0x56, 0x73, 0x7d, 0xfb, 0xb5, 0xa1, 0xc3, 0xde}},
	 258  }
	 259  
	 260  // NIST Special Publication 800-20, Appendix A
	 261  // Key for use with Table A.1 tests
	 262  var tableA1Key = []byte{
	 263  	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 264  	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 265  	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 266  }
	 267  
	 268  // Table A.1 Resulting Ciphertext from the Variable Plaintext Known Answer Test
	 269  var tableA1Tests = []CryptTest{
	 270  	{nil, // 0
	 271  		[]byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 272  		[]byte{0x95, 0xf8, 0xa5, 0xe5, 0xdd, 0x31, 0xd9, 0x00}},
	 273  	{nil, // 1
	 274  		[]byte{0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 275  		[]byte{0xdd, 0x7f, 0x12, 0x1c, 0xa5, 0x01, 0x56, 0x19}},
	 276  	{nil, // 2
	 277  		[]byte{0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 278  		[]byte{0x2e, 0x86, 0x53, 0x10, 0x4f, 0x38, 0x34, 0xea}},
	 279  	{nil, // 3
	 280  		[]byte{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 281  		[]byte{0x4b, 0xd3, 0x88, 0xff, 0x6c, 0xd8, 0x1d, 0x4f}},
	 282  	{nil, // 4
	 283  		[]byte{0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 284  		[]byte{0x20, 0xb9, 0xe7, 0x67, 0xb2, 0xfb, 0x14, 0x56}},
	 285  	{nil, // 5
	 286  		[]byte{0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 287  		[]byte{0x55, 0x57, 0x93, 0x80, 0xd7, 0x71, 0x38, 0xef}},
	 288  	{nil, // 6
	 289  		[]byte{0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 290  		[]byte{0x6c, 0xc5, 0xde, 0xfa, 0xaf, 0x04, 0x51, 0x2f}},
	 291  	{nil, // 7
	 292  		[]byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 293  		[]byte{0x0d, 0x9f, 0x27, 0x9b, 0xa5, 0xd8, 0x72, 0x60}},
	 294  	{nil, // 8
	 295  		[]byte{0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 296  		[]byte{0xd9, 0x03, 0x1b, 0x02, 0x71, 0xbd, 0x5a, 0x0a}},
	 297  	{nil, // 9
	 298  		[]byte{0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 299  		[]byte{0x42, 0x42, 0x50, 0xb3, 0x7c, 0x3d, 0xd9, 0x51}},
	 300  	{nil, // 10
	 301  		[]byte{0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 302  		[]byte{0xb8, 0x06, 0x1b, 0x7e, 0xcd, 0x9a, 0x21, 0xe5}},
	 303  	{nil, // 11
	 304  		[]byte{0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 305  		[]byte{0xf1, 0x5d, 0x0f, 0x28, 0x6b, 0x65, 0xbd, 0x28}},
	 306  	{nil, // 12
	 307  		[]byte{0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 308  		[]byte{0xad, 0xd0, 0xcc, 0x8d, 0x6e, 0x5d, 0xeb, 0xa1}},
	 309  	{nil, // 13
	 310  		[]byte{0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 311  		[]byte{0xe6, 0xd5, 0xf8, 0x27, 0x52, 0xad, 0x63, 0xd1}},
	 312  	{nil, // 14
	 313  		[]byte{0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 314  		[]byte{0xec, 0xbf, 0xe3, 0xbd, 0x3f, 0x59, 0x1a, 0x5e}},
	 315  	{nil, // 15
	 316  		[]byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
	 317  		[]byte{0xf3, 0x56, 0x83, 0x43, 0x79, 0xd1, 0x65, 0xcd}},
	 318  	{nil, // 16
	 319  		[]byte{0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00},
	 320  		[]byte{0x2b, 0x9f, 0x98, 0x2f, 0x20, 0x03, 0x7f, 0xa9}},
	 321  	{nil, // 17
	 322  		[]byte{0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00},
	 323  		[]byte{0x88, 0x9d, 0xe0, 0x68, 0xa1, 0x6f, 0x0b, 0xe6}},
	 324  	{nil, // 18
	 325  		[]byte{0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00},
	 326  		[]byte{0xe1, 0x9e, 0x27, 0x5d, 0x84, 0x6a, 0x12, 0x98}},
	 327  	{nil, // 19
	 328  		[]byte{0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00},
	 329  		[]byte{0x32, 0x9a, 0x8e, 0xd5, 0x23, 0xd7, 0x1a, 0xec}},
	 330  	{nil, // 20
	 331  		[]byte{0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00},
	 332  		[]byte{0xe7, 0xfc, 0xe2, 0x25, 0x57, 0xd2, 0x3c, 0x97}},
	 333  	{nil, // 21
	 334  		[]byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00},
	 335  		[]byte{0x12, 0xa9, 0xf5, 0x81, 0x7f, 0xf2, 0xd6, 0x5d}},
	 336  	{nil, // 22
	 337  		[]byte{0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00},
	 338  		[]byte{0xa4, 0x84, 0xc3, 0xad, 0x38, 0xdc, 0x9c, 0x19}},
	 339  	{nil, // 23
	 340  		[]byte{0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00},
	 341  		[]byte{0xfb, 0xe0, 0x0a, 0x8a, 0x1e, 0xf8, 0xad, 0x72}},
	 342  	{nil, // 24
	 343  		[]byte{0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00},
	 344  		[]byte{0x75, 0x0d, 0x07, 0x94, 0x07, 0x52, 0x13, 0x63}},
	 345  	{nil, // 25
	 346  		[]byte{0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00},
	 347  		[]byte{0x64, 0xfe, 0xed, 0x9c, 0x72, 0x4c, 0x2f, 0xaf}},
	 348  	{nil, // 26
	 349  		[]byte{0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00},
	 350  		[]byte{0xf0, 0x2b, 0x26, 0x3b, 0x32, 0x8e, 0x2b, 0x60}},
	 351  	{nil, // 27
	 352  		[]byte{0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00},
	 353  		[]byte{0x9d, 0x64, 0x55, 0x5a, 0x9a, 0x10, 0xb8, 0x52}},
	 354  	{nil, // 28
	 355  		[]byte{0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00},
	 356  		[]byte{0xd1, 0x06, 0xff, 0x0b, 0xed, 0x52, 0x55, 0xd7}},
	 357  	{nil, // 29
	 358  		[]byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00},
	 359  		[]byte{0xe1, 0x65, 0x2c, 0x6b, 0x13, 0x8c, 0x64, 0xa5}},
	 360  	{nil, // 30
	 361  		[]byte{0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00},
	 362  		[]byte{0xe4, 0x28, 0x58, 0x11, 0x86, 0xec, 0x8f, 0x46}},
	 363  	{nil, // 31
	 364  		[]byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00},
	 365  		[]byte{0xae, 0xb5, 0xf5, 0xed, 0xe2, 0x2d, 0x1a, 0x36}},
	 366  	{nil, // 32
	 367  		[]byte{0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00},
	 368  		[]byte{0xe9, 0x43, 0xd7, 0x56, 0x8a, 0xec, 0x0c, 0x5c}},
	 369  	{nil, // 33
	 370  		[]byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00},
	 371  		[]byte{0xdf, 0x98, 0xc8, 0x27, 0x6f, 0x54, 0xb0, 0x4b}},
	 372  	{nil, // 34
	 373  		[]byte{0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00},
	 374  		[]byte{0xb1, 0x60, 0xe4, 0x68, 0x0f, 0x6c, 0x69, 0x6f}},
	 375  	{nil, // 35
	 376  		[]byte{0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
	 377  		[]byte{0xfa, 0x07, 0x52, 0xb0, 0x7d, 0x9c, 0x4a, 0xb8}},
	 378  	{nil, // 36
	 379  		[]byte{0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00},
	 380  		[]byte{0xca, 0x3a, 0x2b, 0x03, 0x6d, 0xbc, 0x85, 0x02}},
	 381  	{nil, // 37
	 382  		[]byte{0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00},
	 383  		[]byte{0x5e, 0x09, 0x05, 0x51, 0x7b, 0xb5, 0x9b, 0xcf}},
	 384  	{nil, // 38
	 385  		[]byte{0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00},
	 386  		[]byte{0x81, 0x4e, 0xeb, 0x3b, 0x91, 0xd9, 0x07, 0x26}},
	 387  	{nil, // 39
	 388  		[]byte{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00},
	 389  		[]byte{0x4d, 0x49, 0xdb, 0x15, 0x32, 0x91, 0x9c, 0x9f}},
	 390  	{nil, // 40
	 391  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00},
	 392  		[]byte{0x25, 0xeb, 0x5f, 0xc3, 0xf8, 0xcf, 0x06, 0x21}},
	 393  	{nil, // 41
	 394  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00},
	 395  		[]byte{0xab, 0x6a, 0x20, 0xc0, 0x62, 0x0d, 0x1c, 0x6f}},
	 396  	{nil, // 42
	 397  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00},
	 398  		[]byte{0x79, 0xe9, 0x0d, 0xbc, 0x98, 0xf9, 0x2c, 0xca}},
	 399  	{nil, // 43
	 400  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00},
	 401  		[]byte{0x86, 0x6e, 0xce, 0xdd, 0x80, 0x72, 0xbb, 0x0e}},
	 402  	{nil, // 44
	 403  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00},
	 404  		[]byte{0x8b, 0x54, 0x53, 0x6f, 0x2f, 0x3e, 0x64, 0xa8}},
	 405  	{nil, // 45
	 406  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00},
	 407  		[]byte{0xea, 0x51, 0xd3, 0x97, 0x55, 0x95, 0xb8, 0x6b}},
	 408  	{nil, // 46
	 409  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00},
	 410  		[]byte{0xca, 0xff, 0xc6, 0xac, 0x45, 0x42, 0xde, 0x31}},
	 411  	{nil, // 47
	 412  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00},
	 413  		[]byte{0x8d, 0xd4, 0x5a, 0x2d, 0xdf, 0x90, 0x79, 0x6c}},
	 414  	{nil, // 48
	 415  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00},
	 416  		[]byte{0x10, 0x29, 0xd5, 0x5e, 0x88, 0x0e, 0xc2, 0xd0}},
	 417  	{nil, // 49
	 418  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00},
	 419  		[]byte{0x5d, 0x86, 0xcb, 0x23, 0x63, 0x9d, 0xbe, 0xa9}},
	 420  	{nil, // 50
	 421  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00},
	 422  		[]byte{0x1d, 0x1c, 0xa8, 0x53, 0xae, 0x7c, 0x0c, 0x5f}},
	 423  	{nil, // 51
	 424  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00},
	 425  		[]byte{0xce, 0x33, 0x23, 0x29, 0x24, 0x8f, 0x32, 0x28}},
	 426  	{nil, // 52
	 427  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00},
	 428  		[]byte{0x84, 0x05, 0xd1, 0xab, 0xe2, 0x4f, 0xb9, 0x42}},
	 429  	{nil, // 53
	 430  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00},
	 431  		[]byte{0xe6, 0x43, 0xd7, 0x80, 0x90, 0xca, 0x42, 0x07}},
	 432  	{nil, // 54
	 433  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00},
	 434  		[]byte{0x48, 0x22, 0x1b, 0x99, 0x37, 0x74, 0x8a, 0x23}},
	 435  	{nil, // 55
	 436  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00},
	 437  		[]byte{0xdd, 0x7c, 0x0b, 0xbd, 0x61, 0xfa, 0xfd, 0x54}},
	 438  	{nil, // 56
	 439  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80},
	 440  		[]byte{0x2f, 0xbc, 0x29, 0x1a, 0x57, 0x0d, 0xb5, 0xc4}},
	 441  	{nil, // 57
	 442  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40},
	 443  		[]byte{0xe0, 0x7c, 0x30, 0xd7, 0xe4, 0xe2, 0x6e, 0x12}},
	 444  	{nil, // 58
	 445  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20},
	 446  		[]byte{0x09, 0x53, 0xe2, 0x25, 0x8e, 0x8e, 0x90, 0xa1}},
	 447  	{nil, // 59
	 448  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
	 449  		[]byte{0x5b, 0x71, 0x1b, 0xc4, 0xce, 0xeb, 0xf2, 0xee}},
	 450  	{nil, // 60
	 451  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08},
	 452  		[]byte{0xcc, 0x08, 0x3f, 0x1e, 0x6d, 0x9e, 0x85, 0xf6}},
	 453  	{nil, // 61
	 454  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04},
	 455  		[]byte{0xd2, 0xfd, 0x88, 0x67, 0xd5, 0x0d, 0x2d, 0xfe}},
	 456  	{nil, // 62
	 457  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
	 458  		[]byte{0x06, 0xe7, 0xea, 0x22, 0xce, 0x92, 0x70, 0x8f}},
	 459  	{nil, // 63
	 460  		[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
	 461  		[]byte{0x16, 0x6b, 0x40, 0xb4, 0x4a, 0xba, 0x4b, 0xd6}},
	 462  }
	 463  
	 464  // Plaintext for use with Table A.2 tests
	 465  var tableA2Plaintext = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
	 466  
	 467  // Table A.2 Resulting Ciphertext from the Variable Key Known Answer Test
	 468  var tableA2Tests = []CryptTest{
	 469  	{ // 0
	 470  		[]byte{
	 471  			0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 472  			0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 473  			0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 474  		nil,
	 475  		[]byte{0x95, 0xa8, 0xd7, 0x28, 0x13, 0xda, 0xa9, 0x4d}},
	 476  	{ // 1
	 477  		[]byte{
	 478  			0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 479  			0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 480  			0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 481  		nil,
	 482  		[]byte{0x0e, 0xec, 0x14, 0x87, 0xdd, 0x8c, 0x26, 0xd5}},
	 483  	{ // 2
	 484  		[]byte{
	 485  			0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 486  			0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 487  			0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 488  		nil,
	 489  		[]byte{0x7a, 0xd1, 0x6f, 0xfb, 0x79, 0xc4, 0x59, 0x26}},
	 490  	{ // 3
	 491  		[]byte{
	 492  			0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 493  			0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 494  			0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 495  		nil,
	 496  		[]byte{0xd3, 0x74, 0x62, 0x94, 0xca, 0x6a, 0x6c, 0xf3}},
	 497  	{ // 4
	 498  		[]byte{
	 499  			0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 500  			0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 501  			0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 502  		nil,
	 503  		[]byte{0x80, 0x9f, 0x5f, 0x87, 0x3c, 0x1f, 0xd7, 0x61}},
	 504  	{ // 5
	 505  		[]byte{
	 506  			0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 507  			0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 508  			0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 509  		nil,
	 510  		[]byte{0xc0, 0x2f, 0xaf, 0xfe, 0xc9, 0x89, 0xd1, 0xfc}},
	 511  	{ // 6
	 512  		[]byte{
	 513  			0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 514  			0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 515  			0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 516  		nil,
	 517  		[]byte{0x46, 0x15, 0xaa, 0x1d, 0x33, 0xe7, 0x2f, 0x10}},
	 518  	{ // 7
	 519  		[]byte{
	 520  			0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 521  			0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 522  			0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 523  		nil,
	 524  		[]byte{0x20, 0x55, 0x12, 0x33, 0x50, 0xc0, 0x08, 0x58}},
	 525  	{ // 8
	 526  		[]byte{
	 527  			0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 528  			0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 529  			0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 530  		nil,
	 531  		[]byte{0xdf, 0x3b, 0x99, 0xd6, 0x57, 0x73, 0x97, 0xc8}},
	 532  	{ // 9
	 533  		[]byte{
	 534  			0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 535  			0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 536  			0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 537  		nil,
	 538  		[]byte{0x31, 0xfe, 0x17, 0x36, 0x9b, 0x52, 0x88, 0xc9}},
	 539  	{ // 10
	 540  		[]byte{
	 541  			0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 542  			0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 543  			0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 544  		nil,
	 545  		[]byte{0xdf, 0xdd, 0x3c, 0xc6, 0x4d, 0xae, 0x16, 0x42}},
	 546  	{ // 11
	 547  		[]byte{
	 548  			0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 549  			0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 550  			0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 551  		nil,
	 552  		[]byte{0x17, 0x8c, 0x83, 0xce, 0x2b, 0x39, 0x9d, 0x94}},
	 553  	{ // 12
	 554  		[]byte{
	 555  			0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 556  			0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 557  			0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 558  		nil,
	 559  		[]byte{0x50, 0xf6, 0x36, 0x32, 0x4a, 0x9b, 0x7f, 0x80}},
	 560  	{ // 13
	 561  		[]byte{
	 562  			0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 563  			0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
	 564  			0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
	 565  		nil,
	 566  		[]byte{0xa8, 0x46, 0x8e, 0xe3, 0xbc, 0x18, 0xf0, 0x6d}},
	 567  	{ // 14
	 568  		[]byte{
	 569  			0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01,
	 570  			0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01,
	 571  			0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01},
	 572  		nil,
	 573  		[]byte{0xa2, 0xdc, 0x9e, 0x92, 0xfd, 0x3c, 0xde, 0x92}},
	 574  	{ // 15
	 575  		[]byte{
	 576  			0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01,
	 577  			0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01,
	 578  			0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01},
	 579  		nil,
	 580  		[]byte{0xca, 0xc0, 0x9f, 0x79, 0x7d, 0x03, 0x12, 0x87}},
	 581  	{ // 16
	 582  		[]byte{
	 583  			0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01,
	 584  			0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01,
	 585  			0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01},
	 586  		nil,
	 587  		[]byte{0x90, 0xba, 0x68, 0x0b, 0x22, 0xae, 0xb5, 0x25}},
	 588  	{ // 17
	 589  		[]byte{
	 590  			0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01,
	 591  			0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01,
	 592  			0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01},
	 593  		nil,
	 594  		[]byte{0xce, 0x7a, 0x24, 0xf3, 0x50, 0xe2, 0x80, 0xb6}},
	 595  	{ // 18
	 596  		[]byte{
	 597  			0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01,
	 598  			0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01,
	 599  			0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01},
	 600  		nil,
	 601  		[]byte{0x88, 0x2b, 0xff, 0x0a, 0xa0, 0x1a, 0x0b, 0x87}},
	 602  	{ // 19
	 603  		[]byte{
	 604  			0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01,
	 605  			0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01,
	 606  			0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01},
	 607  		nil,
	 608  		[]byte{0x25, 0x61, 0x02, 0x88, 0x92, 0x45, 0x11, 0xc2}},
	 609  	{ // 20
	 610  		[]byte{
	 611  			0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
	 612  			0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
	 613  			0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01},
	 614  		nil,
	 615  		[]byte{0xc7, 0x15, 0x16, 0xc2, 0x9c, 0x75, 0xd1, 0x70}},
	 616  	{ // 21
	 617  		[]byte{
	 618  			0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01,
	 619  			0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01,
	 620  			0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01},
	 621  		nil,
	 622  		[]byte{0x51, 0x99, 0xc2, 0x9a, 0x52, 0xc9, 0xf0, 0x59}},
	 623  	{ // 22
	 624  		[]byte{
	 625  			0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01,
	 626  			0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01,
	 627  			0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01},
	 628  		nil,
	 629  		[]byte{0xc2, 0x2f, 0x0a, 0x29, 0x4a, 0x71, 0xf2, 0x9f}},
	 630  	{ // 23
	 631  		[]byte{
	 632  			0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01,
	 633  			0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01,
	 634  			0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01},
	 635  		nil,
	 636  		[]byte{0xee, 0x37, 0x14, 0x83, 0x71, 0x4c, 0x02, 0xea}},
	 637  	{ // 24
	 638  		[]byte{
	 639  			0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01,
	 640  			0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01,
	 641  			0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01},
	 642  		nil,
	 643  		[]byte{0xa8, 0x1f, 0xbd, 0x44, 0x8f, 0x9e, 0x52, 0x2f}},
	 644  	{ // 25
	 645  		[]byte{
	 646  			0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01,
	 647  			0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01,
	 648  			0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01},
	 649  		nil,
	 650  		[]byte{0x4f, 0x64, 0x4c, 0x92, 0xe1, 0x92, 0xdf, 0xed}},
	 651  	{ // 26
	 652  		[]byte{
	 653  			0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01,
	 654  			0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01,
	 655  			0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01},
	 656  		nil,
	 657  		[]byte{0x1a, 0xfa, 0x9a, 0x66, 0xa6, 0xdf, 0x92, 0xae}},
	 658  	{ // 27
	 659  		[]byte{
	 660  			0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01,
	 661  			0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01,
	 662  			0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01},
	 663  		nil,
	 664  		[]byte{0xb3, 0xc1, 0xcc, 0x71, 0x5c, 0xb8, 0x79, 0xd8}},
	 665  	{ // 28
	 666  		[]byte{
	 667  			0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01,
	 668  			0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01,
	 669  			0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01},
	 670  		nil,
	 671  		[]byte{0x19, 0xd0, 0x32, 0xe6, 0x4a, 0xb0, 0xbd, 0x8b}},
	 672  	{ // 29
	 673  		[]byte{
	 674  			0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01,
	 675  			0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01,
	 676  			0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01},
	 677  		nil,
	 678  		[]byte{0x3c, 0xfa, 0xa7, 0xa7, 0xdc, 0x87, 0x20, 0xdc}},
	 679  	{ // 30
	 680  		[]byte{
	 681  			0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01,
	 682  			0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01,
	 683  			0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01},
	 684  		nil,
	 685  		[]byte{0xb7, 0x26, 0x5f, 0x7f, 0x44, 0x7a, 0xc6, 0xf3}},
	 686  	{ // 31
	 687  		[]byte{
	 688  			0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01,
	 689  			0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01,
	 690  			0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01},
	 691  		nil,
	 692  		[]byte{0x9d, 0xb7, 0x3b, 0x3c, 0x0d, 0x16, 0x3f, 0x54}},
	 693  	{ // 32
	 694  		[]byte{
	 695  			0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01,
	 696  			0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01,
	 697  			0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01},
	 698  		nil,
	 699  		[]byte{0x81, 0x81, 0xb6, 0x5b, 0xab, 0xf4, 0xa9, 0x75}},
	 700  	{ // 33
	 701  		[]byte{
	 702  			0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01,
	 703  			0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01,
	 704  			0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01},
	 705  		nil,
	 706  		[]byte{0x93, 0xc9, 0xb6, 0x40, 0x42, 0xea, 0xa2, 0x40}},
	 707  	{ // 34
	 708  		[]byte{
	 709  			0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01,
	 710  			0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01,
	 711  			0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01},
	 712  		nil,
	 713  		[]byte{0x55, 0x70, 0x53, 0x08, 0x29, 0x70, 0x55, 0x92}},
	 714  	{ // 35
	 715  		[]byte{
	 716  			0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01,
	 717  			0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01,
	 718  			0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01},
	 719  		nil,
	 720  		[]byte{0x86, 0x38, 0x80, 0x9e, 0x87, 0x87, 0x87, 0xa0}},
	 721  	{ // 36
	 722  		[]byte{
	 723  			0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01,
	 724  			0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01,
	 725  			0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01},
	 726  		nil,
	 727  		[]byte{0x41, 0xb9, 0xa7, 0x9a, 0xf7, 0x9a, 0xc2, 0x08}},
	 728  	{ // 37
	 729  		[]byte{
	 730  			0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01,
	 731  			0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01,
	 732  			0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01},
	 733  		nil,
	 734  		[]byte{0x7a, 0x9b, 0xe4, 0x2f, 0x20, 0x09, 0xa8, 0x92}},
	 735  	{ // 38
	 736  		[]byte{
	 737  			0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01,
	 738  			0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01,
	 739  			0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01},
	 740  		nil,
	 741  		[]byte{0x29, 0x03, 0x8d, 0x56, 0xba, 0x6d, 0x27, 0x45}},
	 742  	{ // 39
	 743  		[]byte{
	 744  			0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01,
	 745  			0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01,
	 746  			0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01},
	 747  		nil,
	 748  		[]byte{0x54, 0x95, 0xc6, 0xab, 0xf1, 0xe5, 0xdf, 0x51}},
	 749  	{ // 40
	 750  		[]byte{
	 751  			0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01,
	 752  			0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01,
	 753  			0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01},
	 754  		nil,
	 755  		[]byte{0xae, 0x13, 0xdb, 0xd5, 0x61, 0x48, 0x89, 0x33}},
	 756  	{ // 41
	 757  		[]byte{
	 758  			0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01,
	 759  			0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01,
	 760  			0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01},
	 761  		nil,
	 762  		[]byte{0x02, 0x4d, 0x1f, 0xfa, 0x89, 0x04, 0xe3, 0x89}},
	 763  	{ // 42
	 764  		[]byte{
	 765  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01,
	 766  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01,
	 767  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01},
	 768  		nil,
	 769  		[]byte{0xd1, 0x39, 0x97, 0x12, 0xf9, 0x9b, 0xf0, 0x2e}},
	 770  	{ // 43
	 771  		[]byte{
	 772  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01,
	 773  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01,
	 774  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01},
	 775  		nil,
	 776  		[]byte{0x14, 0xc1, 0xd7, 0xc1, 0xcf, 0xfe, 0xc7, 0x9e}},
	 777  	{ // 44
	 778  		[]byte{
	 779  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01,
	 780  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01,
	 781  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01},
	 782  		nil,
	 783  		[]byte{0x1d, 0xe5, 0x27, 0x9d, 0xae, 0x3b, 0xed, 0x6f}},
	 784  	{ // 45
	 785  		[]byte{
	 786  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01,
	 787  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01,
	 788  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01},
	 789  		nil,
	 790  		[]byte{0xe9, 0x41, 0xa3, 0x3f, 0x85, 0x50, 0x13, 0x03}},
	 791  	{ // 46
	 792  		[]byte{
	 793  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01,
	 794  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01,
	 795  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01},
	 796  		nil,
	 797  		[]byte{0xda, 0x99, 0xdb, 0xbc, 0x9a, 0x03, 0xf3, 0x79}},
	 798  	{ // 47
	 799  		[]byte{
	 800  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01,
	 801  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01,
	 802  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01},
	 803  		nil,
	 804  		[]byte{0xb7, 0xfc, 0x92, 0xf9, 0x1d, 0x8e, 0x92, 0xe9}},
	 805  	{ // 48
	 806  		[]byte{
	 807  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01,
	 808  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01,
	 809  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01},
	 810  		nil,
	 811  		[]byte{0xae, 0x8e, 0x5c, 0xaa, 0x3c, 0xa0, 0x4e, 0x85}},
	 812  	{ // 49
	 813  		[]byte{
	 814  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80,
	 815  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80,
	 816  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80},
	 817  		nil,
	 818  		[]byte{0x9c, 0xc6, 0x2d, 0xf4, 0x3b, 0x6e, 0xed, 0x74}},
	 819  	{ // 50
	 820  		[]byte{
	 821  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40,
	 822  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40,
	 823  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40},
	 824  		nil,
	 825  		[]byte{0xd8, 0x63, 0xdb, 0xb5, 0xc5, 0x9a, 0x91, 0xa0}},
	 826  	{ // 50
	 827  		[]byte{
	 828  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20,
	 829  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20,
	 830  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20},
	 831  		nil,
	 832  		[]byte{0xa1, 0xab, 0x21, 0x90, 0x54, 0x5b, 0x91, 0xd7}},
	 833  	{ // 52
	 834  		[]byte{
	 835  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10,
	 836  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10,
	 837  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10},
	 838  		nil,
	 839  		[]byte{0x08, 0x75, 0x04, 0x1e, 0x64, 0xc5, 0x70, 0xf7}},
	 840  	{ // 53
	 841  		[]byte{
	 842  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08,
	 843  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08,
	 844  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08},
	 845  		nil,
	 846  		[]byte{0x5a, 0x59, 0x45, 0x28, 0xbe, 0xbe, 0xf1, 0xcc}},
	 847  	{ // 54
	 848  		[]byte{
	 849  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04,
	 850  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04,
	 851  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04},
	 852  		nil,
	 853  		[]byte{0xfc, 0xdb, 0x32, 0x91, 0xde, 0x21, 0xf0, 0xc0}},
	 854  	{ // 55
	 855  		[]byte{
	 856  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
	 857  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02,
	 858  			0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02},
	 859  		nil,
	 860  		[]byte{0x86, 0x9e, 0xfd, 0x7f, 0x9f, 0x26, 0x5a, 0x09}},
	 861  }
	 862  
	 863  // Plaintext for use with Table A.3 tests
	 864  var tableA3Plaintext = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
	 865  
	 866  // Table A.3 Values To Be Used for the Permutation Operation Known Answer Test
	 867  var tableA3Tests = []CryptTest{
	 868  	{ // 0
	 869  		[]byte{
	 870  			0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31,
	 871  			0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31,
	 872  			0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31,
	 873  		},
	 874  		nil,
	 875  		[]byte{0x88, 0xd5, 0x5e, 0x54, 0xf5, 0x4c, 0x97, 0xb4}},
	 876  	{ // 1
	 877  		[]byte{
	 878  			0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
	 879  			0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
	 880  			0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
	 881  		},
	 882  		nil,
	 883  		[]byte{0x0c, 0x0c, 0xc0, 0x0c, 0x83, 0xea, 0x48, 0xfd}},
	 884  	{ // 2
	 885  		[]byte{
	 886  			0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20,
	 887  			0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20,
	 888  			0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20,
	 889  		},
	 890  		nil,
	 891  		[]byte{0x83, 0xbc, 0x8e, 0xf3, 0xa6, 0x57, 0x01, 0x83}},
	 892  	{ // 3
	 893  		[]byte{
	 894  			0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
	 895  			0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
	 896  			0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
	 897  		},
	 898  		nil,
	 899  		[]byte{0xdf, 0x72, 0x5d, 0xca, 0xd9, 0x4e, 0xa2, 0xe9}},
	 900  	{ // 4
	 901  		[]byte{
	 902  			0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01,
	 903  			0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01,
	 904  			0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01,
	 905  		},
	 906  		nil,
	 907  		[]byte{0xe6, 0x52, 0xb5, 0x3b, 0x55, 0x0b, 0xe8, 0xb0}},
	 908  	{ // 5
	 909  		[]byte{
	 910  			0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01,
	 911  			0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01,
	 912  			0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01,
	 913  		},
	 914  		nil,
	 915  		[]byte{0xaf, 0x52, 0x71, 0x20, 0xc4, 0x85, 0xcb, 0xb0}},
	 916  	{ // 6
	 917  		[]byte{
	 918  			0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01,
	 919  			0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01,
	 920  			0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01,
	 921  		},
	 922  		nil,
	 923  		[]byte{0x0f, 0x04, 0xce, 0x39, 0x3d, 0xb9, 0x26, 0xd5}},
	 924  	{ // 7
	 925  		[]byte{
	 926  			0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01,
	 927  			0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01,
	 928  			0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01,
	 929  		},
	 930  		nil,
	 931  		[]byte{0xc9, 0xf0, 0x0f, 0xfc, 0x74, 0x07, 0x90, 0x67}},
	 932  	{ // 8
	 933  		[]byte{
	 934  			0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01,
	 935  			0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01,
	 936  			0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01,
	 937  		},
	 938  		nil,
	 939  		[]byte{0x7c, 0xfd, 0x82, 0xa5, 0x93, 0x25, 0x2b, 0x4e}},
	 940  	{ // 9
	 941  		[]byte{
	 942  			0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01,
	 943  			0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01,
	 944  			0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01,
	 945  		},
	 946  		nil,
	 947  		[]byte{0xcb, 0x49, 0xa2, 0xf9, 0xe9, 0x13, 0x63, 0xe3}},
	 948  	{ // 10
	 949  		[]byte{
	 950  			0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40,
	 951  			0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40,
	 952  			0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40,
	 953  		},
	 954  		nil,
	 955  		[]byte{0x00, 0xb5, 0x88, 0xbe, 0x70, 0xd2, 0x3f, 0x56}},
	 956  	{ // 11
	 957  		[]byte{
	 958  			0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40,
	 959  			0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40,
	 960  			0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40,
	 961  		},
	 962  		nil,
	 963  		[]byte{0x40, 0x6a, 0x9a, 0x6a, 0xb4, 0x33, 0x99, 0xae}},
	 964  	{ // 12
	 965  		[]byte{
	 966  			0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01,
	 967  			0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01,
	 968  			0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01,
	 969  		},
	 970  		nil,
	 971  		[]byte{0x6c, 0xb7, 0x73, 0x61, 0x1d, 0xca, 0x9a, 0xda}},
	 972  	{ // 13
	 973  		[]byte{
	 974  			0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01,
	 975  			0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01,
	 976  			0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01,
	 977  		},
	 978  		nil,
	 979  		[]byte{0x67, 0xfd, 0x21, 0xc1, 0x7d, 0xbb, 0x5d, 0x70}},
	 980  	{ // 14
	 981  		[]byte{
	 982  			0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
	 983  			0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
	 984  			0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
	 985  		},
	 986  		nil,
	 987  		[]byte{0x95, 0x92, 0xcb, 0x41, 0x10, 0x43, 0x07, 0x87}},
	 988  	{ // 15
	 989  		[]byte{
	 990  			0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20,
	 991  			0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20,
	 992  			0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20,
	 993  		},
	 994  		nil,
	 995  		[]byte{0xa6, 0xb7, 0xff, 0x68, 0xa3, 0x18, 0xdd, 0xd3}},
	 996  	{ // 16
	 997  		[]byte{
	 998  			0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01,
	 999  			0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01,
	1000  			0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01,
	1001  		},
	1002  		nil,
	1003  		[]byte{0x4d, 0x10, 0x21, 0x96, 0xc9, 0x14, 0xca, 0x16}},
	1004  	{ // 17
	1005  		[]byte{
	1006  			0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01,
	1007  			0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01,
	1008  			0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01,
	1009  		},
	1010  		nil,
	1011  		[]byte{0x2d, 0xfa, 0x9f, 0x45, 0x73, 0x59, 0x49, 0x65}},
	1012  	{ // 18
	1013  		[]byte{
	1014  			0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01,
	1015  			0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01,
	1016  			0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01,
	1017  		},
	1018  		nil,
	1019  		[]byte{0xb4, 0x66, 0x04, 0x81, 0x6c, 0x0e, 0x07, 0x74}},
	1020  	{ // 19
	1021  		[]byte{
	1022  			0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01,
	1023  			0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01,
	1024  			0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01,
	1025  		},
	1026  		nil,
	1027  		[]byte{0x6e, 0x7e, 0x62, 0x21, 0xa4, 0xf3, 0x4e, 0x87}},
	1028  	{ // 20
	1029  		[]byte{
	1030  			0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01,
	1031  			0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01,
	1032  			0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01,
	1033  		},
	1034  		nil,
	1035  		[]byte{0xaa, 0x85, 0xe7, 0x46, 0x43, 0x23, 0x31, 0x99}},
	1036  	{ // 21
	1037  		[]byte{
	1038  			0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01,
	1039  			0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01,
	1040  			0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01,
	1041  		},
	1042  		nil,
	1043  		[]byte{0x2e, 0x5a, 0x19, 0xdb, 0x4d, 0x19, 0x62, 0xd6}},
	1044  	{ // 22
	1045  		[]byte{
	1046  			0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01,
	1047  			0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01,
	1048  			0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01,
	1049  		},
	1050  		nil,
	1051  		[]byte{0x23, 0xa8, 0x66, 0xa8, 0x09, 0xd3, 0x08, 0x94}},
	1052  	{ // 23
	1053  		[]byte{
	1054  			0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01,
	1055  			0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01,
	1056  			0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01,
	1057  		},
	1058  		nil,
	1059  		[]byte{0xd8, 0x12, 0xd9, 0x61, 0xf0, 0x17, 0xd3, 0x20}},
	1060  	{ // 24
	1061  		[]byte{
	1062  			0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b,
	1063  			0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b,
	1064  			0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b,
	1065  		},
	1066  		nil,
	1067  		[]byte{0x05, 0x56, 0x05, 0x81, 0x6e, 0x58, 0x60, 0x8f}},
	1068  	{ // 25
	1069  		[]byte{
	1070  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01,
	1071  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01,
	1072  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01,
	1073  		},
	1074  		nil,
	1075  		[]byte{0xab, 0xd8, 0x8e, 0x8b, 0x1b, 0x77, 0x16, 0xf1}},
	1076  	{ // 26
	1077  		[]byte{
	1078  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02,
	1079  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02,
	1080  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02,
	1081  		},
	1082  		nil,
	1083  		[]byte{0x53, 0x7a, 0xc9, 0x5b, 0xe6, 0x9d, 0xa1, 0xe1}},
	1084  	{ // 27
	1085  		[]byte{
	1086  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08,
	1087  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08,
	1088  			0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08,
	1089  		},
	1090  		nil,
	1091  		[]byte{0xae, 0xd0, 0xf6, 0xae, 0x3c, 0x25, 0xcd, 0xd8}},
	1092  	{ // 28
	1093  		[]byte{
	1094  			0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04,
	1095  			0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04,
	1096  			0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04,
	1097  		},
	1098  		nil,
	1099  		[]byte{0xb3, 0xe3, 0x5a, 0x5e, 0xe5, 0x3e, 0x7b, 0x8d}},
	1100  	{ // 29
	1101  		[]byte{
	1102  			0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04,
	1103  			0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04,
	1104  			0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04,
	1105  		},
	1106  		nil,
	1107  		[]byte{0x61, 0xc7, 0x9c, 0x71, 0x92, 0x1a, 0x2e, 0xf8}},
	1108  	{ // 30
	1109  		[]byte{
	1110  			0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01,
	1111  			0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01,
	1112  			0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01,
	1113  		},
	1114  		nil,
	1115  		[]byte{0xe2, 0xf5, 0x72, 0x8f, 0x09, 0x95, 0x01, 0x3c}},
	1116  	{ // 31
	1117  		[]byte{
	1118  			0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01,
	1119  			0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01,
	1120  			0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01,
	1121  		},
	1122  		nil,
	1123  		[]byte{0x1a, 0xea, 0xc3, 0x9a, 0x61, 0xf0, 0xa4, 0x64}},
	1124  }
	1125  
	1126  // Table A.4 Values To Be Used for the Substitution Table Known Answer Test
	1127  var tableA4Tests = []CryptTest{
	1128  	{ // 0
	1129  		[]byte{
	1130  			0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57,
	1131  			0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57,
	1132  			0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57},
	1133  		[]byte{0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42},
	1134  		[]byte{0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b}},
	1135  	{ // 1
	1136  		[]byte{
	1137  			0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e,
	1138  			0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e,
	1139  			0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e},
	1140  		[]byte{0x5c, 0xd5, 0x4c, 0xa8, 0x3d, 0xef, 0x57, 0xda},
	1141  		[]byte{0x7a, 0x38, 0x9d, 0x10, 0x35, 0x4b, 0xd2, 0x71}},
	1142  	{ // 2
	1143  		[]byte{
	1144  			0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86,
	1145  			0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86,
	1146  			0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86},
	1147  		[]byte{0x02, 0x48, 0xd4, 0x38, 0x06, 0xf6, 0x71, 0x72},
	1148  		[]byte{0x86, 0x8e, 0xbb, 0x51, 0xca, 0xb4, 0x59, 0x9a}},
	1149  	{ // 3
	1150  		[]byte{
	1151  			0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e,
	1152  			0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e,
	1153  			0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e},
	1154  		[]byte{0x51, 0x45, 0x4b, 0x58, 0x2d, 0xdf, 0x44, 0x0a},
	1155  		[]byte{0x71, 0x78, 0x87, 0x6e, 0x01, 0xf1, 0x9b, 0x2a}},
	1156  	{ // 4
	1157  		[]byte{
	1158  			0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6,
	1159  			0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6,
	1160  			0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6},
	1161  		[]byte{0x42, 0xfd, 0x44, 0x30, 0x59, 0x57, 0x7f, 0xa2},
	1162  		[]byte{0xaf, 0x37, 0xfb, 0x42, 0x1f, 0x8c, 0x40, 0x95}},
	1163  	{ // 5
	1164  		[]byte{
	1165  			0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce,
	1166  			0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce,
	1167  			0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce},
	1168  		[]byte{0x05, 0x9b, 0x5e, 0x08, 0x51, 0xcf, 0x14, 0x3a},
	1169  		[]byte{0x86, 0xa5, 0x60, 0xf1, 0x0e, 0xc6, 0xd8, 0x5b}},
	1170  	{ // 6
	1171  		[]byte{
	1172  			0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6,
	1173  			0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6,
	1174  			0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6},
	1175  		[]byte{0x07, 0x56, 0xd8, 0xe0, 0x77, 0x47, 0x61, 0xd2},
	1176  		[]byte{0x0c, 0xd3, 0xda, 0x02, 0x00, 0x21, 0xdc, 0x09}},
	1177  	{ // 7
	1178  		[]byte{
	1179  			0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe,
	1180  			0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe,
	1181  			0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe},
	1182  		[]byte{0x76, 0x25, 0x14, 0xb8, 0x29, 0xbf, 0x48, 0x6a},
	1183  		[]byte{0xea, 0x67, 0x6b, 0x2c, 0xb7, 0xdb, 0x2b, 0x7a}},
	1184  	{ // 8
	1185  		[]byte{
	1186  			0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16,
	1187  			0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16,
	1188  			0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16},
	1189  		[]byte{0x3b, 0xdd, 0x11, 0x90, 0x49, 0x37, 0x28, 0x02},
	1190  		[]byte{0xdf, 0xd6, 0x4a, 0x81, 0x5c, 0xaf, 0x1a, 0x0f}},
	1191  	{ // 9
	1192  		[]byte{
	1193  			0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
	1194  			0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
	1195  			0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f},
	1196  		[]byte{0x26, 0x95, 0x5f, 0x68, 0x35, 0xaf, 0x60, 0x9a},
	1197  		[]byte{0x5c, 0x51, 0x3c, 0x9c, 0x48, 0x86, 0xc0, 0x88}},
	1198  	{ // 10
	1199  		[]byte{
	1200  			0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46,
	1201  			0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46,
	1202  			0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46},
	1203  		[]byte{0x16, 0x4d, 0x5e, 0x40, 0x4f, 0x27, 0x52, 0x32},
	1204  		[]byte{0x0a, 0x2a, 0xee, 0xae, 0x3f, 0xf4, 0xab, 0x77}},
	1205  	{ // 11
	1206  		[]byte{
	1207  			0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e,
	1208  			0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e,
	1209  			0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e},
	1210  		[]byte{0x6b, 0x05, 0x6e, 0x18, 0x75, 0x9f, 0x5c, 0xca},
	1211  		[]byte{0xef, 0x1b, 0xf0, 0x3e, 0x5d, 0xfa, 0x57, 0x5a}},
	1212  	{ // 12
	1213  		[]byte{
	1214  			0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
	1215  			0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
	1216  			0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76},
	1217  		[]byte{0x00, 0x4b, 0xd6, 0xef, 0x09, 0x17, 0x60, 0x62},
	1218  		[]byte{0x88, 0xbf, 0x0d, 0xb6, 0xd7, 0x0d, 0xee, 0x56}},
	1219  	{ // 13
	1220  		[]byte{
	1221  			0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07,
	1222  			0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07,
	1223  			0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07},
	1224  		[]byte{0x48, 0x0d, 0x39, 0x00, 0x6e, 0xe7, 0x62, 0xf2},
	1225  		[]byte{0xa1, 0xf9, 0x91, 0x55, 0x41, 0x02, 0x0b, 0x56}},
	1226  	{ // 14
	1227  		[]byte{
	1228  			0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f,
	1229  			0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f,
	1230  			0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f},
	1231  		[]byte{0x43, 0x75, 0x40, 0xc8, 0x69, 0x8f, 0x3c, 0xfa},
	1232  		[]byte{0x6f, 0xbf, 0x1c, 0xaf, 0xcf, 0xfd, 0x05, 0x56}},
	1233  	{ // 15
	1234  		[]byte{
	1235  			0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7,
	1236  			0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7,
	1237  			0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7},
	1238  		[]byte{0x07, 0x2d, 0x43, 0xa0, 0x77, 0x07, 0x52, 0x92},
	1239  		[]byte{0x2f, 0x22, 0xe4, 0x9b, 0xab, 0x7c, 0xa1, 0xac}},
	1240  	{ // 16
	1241  		[]byte{
	1242  			0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf,
	1243  			0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf,
	1244  			0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf},
	1245  		[]byte{0x02, 0xfe, 0x55, 0x77, 0x81, 0x17, 0xf1, 0x2a},
	1246  		[]byte{0x5a, 0x6b, 0x61, 0x2c, 0xc2, 0x6c, 0xce, 0x4a}},
	1247  	{ // 17
	1248  		[]byte{
	1249  			0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6,
	1250  			0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6,
	1251  			0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6},
	1252  		[]byte{0x1d, 0x9d, 0x5c, 0x50, 0x18, 0xf7, 0x28, 0xc2},
	1253  		[]byte{0x5f, 0x4c, 0x03, 0x8e, 0xd1, 0x2b, 0x2e, 0x41}},
	1254  	{ // 18
	1255  		[]byte{
	1256  			0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef,
	1257  			0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef,
	1258  			0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef},
	1259  		[]byte{0x30, 0x55, 0x32, 0x28, 0x6d, 0x6f, 0x29, 0x5a},
	1260  		[]byte{0x63, 0xfa, 0xc0, 0xd0, 0x34, 0xd9, 0xf7, 0x93}},
	1261  }
	1262  
	1263  func newCipher(key []byte) *desCipher {
	1264  	c, err := NewCipher(key)
	1265  	if err != nil {
	1266  		panic("NewCipher failed: " + err.Error())
	1267  	}
	1268  	return c.(*desCipher)
	1269  }
	1270  
	1271  // Use the known weak keys to test DES implementation
	1272  func TestWeakKeys(t *testing.T) {
	1273  	for i, tt := range weakKeyTests {
	1274  		var encrypt = func(in []byte) (out []byte) {
	1275  			c := newCipher(tt.key)
	1276  			out = make([]byte, len(in))
	1277  			encryptBlock(c.subkeys[:], out, in)
	1278  			return
	1279  		}
	1280  
	1281  		// Encrypting twice with a DES weak
	1282  		// key should reproduce the original input
	1283  		result := encrypt(tt.in)
	1284  		result = encrypt(result)
	1285  
	1286  		if !bytes.Equal(result, tt.in) {
	1287  			t.Errorf("#%d: result: %x want: %x", i, result, tt.in)
	1288  		}
	1289  	}
	1290  }
	1291  
	1292  // Use the known semi-weak key pairs to test DES implementation
	1293  func TestSemiWeakKeyPairs(t *testing.T) {
	1294  	for i, tt := range semiWeakKeyTests {
	1295  		var encrypt = func(key, in []byte) (out []byte) {
	1296  			c := newCipher(key)
	1297  			out = make([]byte, len(in))
	1298  			encryptBlock(c.subkeys[:], out, in)
	1299  			return
	1300  		}
	1301  
	1302  		// Encrypting with one member of the semi-weak pair
	1303  		// and then encrypting the result with the other member
	1304  		// should reproduce the original input.
	1305  		result := encrypt(tt.key, tt.in)
	1306  		result = encrypt(tt.out, result)
	1307  
	1308  		if !bytes.Equal(result, tt.in) {
	1309  			t.Errorf("#%d: result: %x want: %x", i, result, tt.in)
	1310  		}
	1311  	}
	1312  }
	1313  
	1314  func TestDESEncryptBlock(t *testing.T) {
	1315  	for i, tt := range encryptDESTests {
	1316  		c := newCipher(tt.key)
	1317  		out := make([]byte, len(tt.in))
	1318  		encryptBlock(c.subkeys[:], out, tt.in)
	1319  
	1320  		if !bytes.Equal(out, tt.out) {
	1321  			t.Errorf("#%d: result: %x want: %x", i, out, tt.out)
	1322  		}
	1323  	}
	1324  }
	1325  
	1326  func TestDESDecryptBlock(t *testing.T) {
	1327  	for i, tt := range encryptDESTests {
	1328  		c := newCipher(tt.key)
	1329  		plain := make([]byte, len(tt.in))
	1330  		decryptBlock(c.subkeys[:], plain, tt.out)
	1331  
	1332  		if !bytes.Equal(plain, tt.in) {
	1333  			t.Errorf("#%d: result: %x want: %x", i, plain, tt.in)
	1334  		}
	1335  	}
	1336  }
	1337  
	1338  func TestEncryptTripleDES(t *testing.T) {
	1339  	for i, tt := range encryptTripleDESTests {
	1340  		c, _ := NewTripleDESCipher(tt.key)
	1341  		out := make([]byte, len(tt.in))
	1342  		c.Encrypt(out, tt.in)
	1343  
	1344  		if !bytes.Equal(out, tt.out) {
	1345  			t.Errorf("#%d: result: %x want: %x", i, out, tt.out)
	1346  		}
	1347  	}
	1348  }
	1349  
	1350  func TestDecryptTripleDES(t *testing.T) {
	1351  	for i, tt := range encryptTripleDESTests {
	1352  		c, _ := NewTripleDESCipher(tt.key)
	1353  
	1354  		plain := make([]byte, len(tt.in))
	1355  		c.Decrypt(plain, tt.out)
	1356  
	1357  		if !bytes.Equal(plain, tt.in) {
	1358  			t.Errorf("#%d: result: %x want: %x", i, plain, tt.in)
	1359  		}
	1360  	}
	1361  }
	1362  
	1363  // Defined in Pub 800-20
	1364  func TestVariablePlaintextKnownAnswer(t *testing.T) {
	1365  	for i, tt := range tableA1Tests {
	1366  		c, _ := NewTripleDESCipher(tableA1Key)
	1367  
	1368  		out := make([]byte, len(tt.in))
	1369  		c.Encrypt(out, tt.in)
	1370  
	1371  		if !bytes.Equal(out, tt.out) {
	1372  			t.Errorf("#%d: result: %x want: %x", i, out, tt.out)
	1373  		}
	1374  	}
	1375  }
	1376  
	1377  // Defined in Pub 800-20
	1378  func TestVariableCiphertextKnownAnswer(t *testing.T) {
	1379  	for i, tt := range tableA1Tests {
	1380  		c, _ := NewTripleDESCipher(tableA1Key)
	1381  
	1382  		plain := make([]byte, len(tt.out))
	1383  		c.Decrypt(plain, tt.out)
	1384  
	1385  		if !bytes.Equal(plain, tt.in) {
	1386  			t.Errorf("#%d: result: %x want: %x", i, plain, tt.in)
	1387  		}
	1388  	}
	1389  }
	1390  
	1391  // Defined in Pub 800-20
	1392  // Encrypting the Table A.1 ciphertext with the
	1393  // 0x01... key produces the original plaintext
	1394  func TestInversePermutationKnownAnswer(t *testing.T) {
	1395  	for i, tt := range tableA1Tests {
	1396  		c, _ := NewTripleDESCipher(tableA1Key)
	1397  
	1398  		plain := make([]byte, len(tt.in))
	1399  		c.Encrypt(plain, tt.out)
	1400  
	1401  		if !bytes.Equal(plain, tt.in) {
	1402  			t.Errorf("#%d: result: %x want: %x", i, plain, tt.in)
	1403  		}
	1404  	}
	1405  }
	1406  
	1407  // Defined in Pub 800-20
	1408  // Decrypting the Table A.1 plaintext with the
	1409  // 0x01... key produces the corresponding ciphertext
	1410  func TestInitialPermutationKnownAnswer(t *testing.T) {
	1411  	for i, tt := range tableA1Tests {
	1412  		c, _ := NewTripleDESCipher(tableA1Key)
	1413  
	1414  		out := make([]byte, len(tt.in))
	1415  		c.Decrypt(out, tt.in)
	1416  
	1417  		if !bytes.Equal(out, tt.out) {
	1418  			t.Errorf("#%d: result: %x want: %x", i, out, tt.out)
	1419  		}
	1420  	}
	1421  }
	1422  
	1423  // Defined in Pub 800-20
	1424  func TestVariableKeyKnownAnswerEncrypt(t *testing.T) {
	1425  	for i, tt := range tableA2Tests {
	1426  		c, _ := NewTripleDESCipher(tt.key)
	1427  
	1428  		out := make([]byte, len(tableA2Plaintext))
	1429  		c.Encrypt(out, tableA2Plaintext)
	1430  
	1431  		if !bytes.Equal(out, tt.out) {
	1432  			t.Errorf("#%d: result: %x want: %x", i, out, tt.out)
	1433  		}
	1434  	}
	1435  }
	1436  
	1437  // Defined in Pub 800-20
	1438  func TestVariableKeyKnownAnswerDecrypt(t *testing.T) {
	1439  	for i, tt := range tableA2Tests {
	1440  		c, _ := NewTripleDESCipher(tt.key)
	1441  
	1442  		out := make([]byte, len(tt.out))
	1443  		c.Decrypt(out, tt.out)
	1444  
	1445  		if !bytes.Equal(out, tableA2Plaintext) {
	1446  			t.Errorf("#%d: result: %x want: %x", i, out, tableA2Plaintext)
	1447  		}
	1448  	}
	1449  }
	1450  
	1451  // Defined in Pub 800-20
	1452  func TestPermutationOperationKnownAnswerEncrypt(t *testing.T) {
	1453  	for i, tt := range tableA3Tests {
	1454  		c, _ := NewTripleDESCipher(tt.key)
	1455  
	1456  		out := make([]byte, len(tableA3Plaintext))
	1457  		c.Encrypt(out, tableA3Plaintext)
	1458  
	1459  		if !bytes.Equal(out, tt.out) {
	1460  			t.Errorf("#%d: result: %x want: %x", i, out, tt.out)
	1461  		}
	1462  	}
	1463  }
	1464  
	1465  // Defined in Pub 800-20
	1466  func TestPermutationOperationKnownAnswerDecrypt(t *testing.T) {
	1467  	for i, tt := range tableA3Tests {
	1468  		c, _ := NewTripleDESCipher(tt.key)
	1469  
	1470  		out := make([]byte, len(tt.out))
	1471  		c.Decrypt(out, tt.out)
	1472  
	1473  		if !bytes.Equal(out, tableA3Plaintext) {
	1474  			t.Errorf("#%d: result: %x want: %x", i, out, tableA3Plaintext)
	1475  		}
	1476  	}
	1477  }
	1478  
	1479  // Defined in Pub 800-20
	1480  func TestSubstitutionTableKnownAnswerEncrypt(t *testing.T) {
	1481  	for i, tt := range tableA4Tests {
	1482  		c, _ := NewTripleDESCipher(tt.key)
	1483  
	1484  		out := make([]byte, len(tt.in))
	1485  		c.Encrypt(out, tt.in)
	1486  
	1487  		if !bytes.Equal(out, tt.out) {
	1488  			t.Errorf("#%d: result: %x want: %x", i, out, tt.out)
	1489  		}
	1490  	}
	1491  }
	1492  
	1493  // Defined in Pub 800-20
	1494  func TestSubstitutionTableKnownAnswerDecrypt(t *testing.T) {
	1495  	for i, tt := range tableA4Tests {
	1496  		c, _ := NewTripleDESCipher(tt.key)
	1497  
	1498  		out := make([]byte, len(tt.out))
	1499  		c.Decrypt(out, tt.out)
	1500  
	1501  		if !bytes.Equal(out, tt.in) {
	1502  			t.Errorf("#%d: result: %x want: %x", i, out, tt.in)
	1503  		}
	1504  	}
	1505  }
	1506  
	1507  func TestInitialPermute(t *testing.T) {
	1508  	for i := uint(0); i < 64; i++ {
	1509  		bit := uint64(1) << i
	1510  		got := permuteInitialBlock(bit)
	1511  		want := uint64(1) << finalPermutation[63-i]
	1512  		if got != want {
	1513  			t.Errorf("permute(%x) = %x, want %x", bit, got, want)
	1514  		}
	1515  	}
	1516  }
	1517  
	1518  func TestFinalPermute(t *testing.T) {
	1519  	for i := uint(0); i < 64; i++ {
	1520  		bit := uint64(1) << i
	1521  		got := permuteFinalBlock(bit)
	1522  		want := uint64(1) << initialPermutation[63-i]
	1523  		if got != want {
	1524  			t.Errorf("permute(%x) = %x, want %x", bit, got, want)
	1525  		}
	1526  	}
	1527  }
	1528  
	1529  func BenchmarkEncrypt(b *testing.B) {
	1530  	tt := encryptDESTests[0]
	1531  	c, err := NewCipher(tt.key)
	1532  	if err != nil {
	1533  		b.Fatal("NewCipher:", err)
	1534  	}
	1535  	out := make([]byte, len(tt.in))
	1536  	b.SetBytes(int64(len(out)))
	1537  	b.ResetTimer()
	1538  	for i := 0; i < b.N; i++ {
	1539  		c.Encrypt(out, tt.in)
	1540  	}
	1541  }
	1542  
	1543  func BenchmarkDecrypt(b *testing.B) {
	1544  	tt := encryptDESTests[0]
	1545  	c, err := NewCipher(tt.key)
	1546  	if err != nil {
	1547  		b.Fatal("NewCipher:", err)
	1548  	}
	1549  	out := make([]byte, len(tt.out))
	1550  	b.SetBytes(int64(len(out)))
	1551  	b.ResetTimer()
	1552  	for i := 0; i < b.N; i++ {
	1553  		c.Decrypt(out, tt.out)
	1554  	}
	1555  }
	1556  
	1557  func BenchmarkTDESEncrypt(b *testing.B) {
	1558  	tt := encryptTripleDESTests[0]
	1559  	c, err := NewTripleDESCipher(tt.key)
	1560  	if err != nil {
	1561  		b.Fatal("NewCipher:", err)
	1562  	}
	1563  	out := make([]byte, len(tt.in))
	1564  	b.SetBytes(int64(len(out)))
	1565  	b.ResetTimer()
	1566  	for i := 0; i < b.N; i++ {
	1567  		c.Encrypt(out, tt.in)
	1568  	}
	1569  }
	1570  
	1571  func BenchmarkTDESDecrypt(b *testing.B) {
	1572  	tt := encryptTripleDESTests[0]
	1573  	c, err := NewTripleDESCipher(tt.key)
	1574  	if err != nil {
	1575  		b.Fatal("NewCipher:", err)
	1576  	}
	1577  	out := make([]byte, len(tt.out))
	1578  	b.SetBytes(int64(len(out)))
	1579  	b.ResetTimer()
	1580  	for i := 0; i < b.N; i++ {
	1581  		c.Decrypt(out, tt.out)
	1582  	}
	1583  }
	1584  

View as plain text