Commit 3478891d authored by Robert Griesemer's avatar Robert Griesemer

gofmt -s -w src misc

R=r, rsc
CC=golang-dev
https://golang.org/cl/2662041
parent f613015e
...@@ -58,8 +58,8 @@ func runLog(envv []string, logfile, dir string, argv ...string) (output string, ...@@ -58,8 +58,8 @@ func runLog(envv []string, logfile, dir string, argv ...string) (output string,
// Find bin in PATH if a relative or absolute path hasn't been specified // Find bin in PATH if a relative or absolute path hasn't been specified
func pathLookup(s string) (string, os.Error) { func pathLookup(s string) (string, os.Error) {
if strings.HasPrefix(s, "/") || strings.HasPrefix(s, "./") || strings.HasPrefix(s, "../") { if strings.HasPrefix(s, "/") || strings.HasPrefix(s, "./") || strings.HasPrefix(s, "../") {
return s, nil return s, nil
} }
return exec.LookPath(s) return exec.LookPath(s)
} }
...@@ -299,17 +299,17 @@ type Resrv struct { ...@@ -299,17 +299,17 @@ type Resrv struct {
} }
var resrv = []Resrv{ var resrv = []Resrv{
Resrv{"binary", BINARY}, {"binary", BINARY},
Resrv{"left", LEFT}, {"left", LEFT},
Resrv{"nonassoc", BINARY}, {"nonassoc", BINARY},
Resrv{"prec", PREC}, {"prec", PREC},
Resrv{"right", RIGHT}, {"right", RIGHT},
Resrv{"start", START}, {"start", START},
Resrv{"term", TERM}, {"term", TERM},
Resrv{"token", TERM}, {"token", TERM},
Resrv{"type", TYPEDEF}, {"type", TYPEDEF},
Resrv{"union", UNION}, {"union", UNION},
Resrv{"struct", UNION}, {"struct", UNION},
} }
var zznewstate = 0 var zznewstate = 0
......
...@@ -27,31 +27,31 @@ type ZipTestFile struct { ...@@ -27,31 +27,31 @@ type ZipTestFile struct {
} }
var tests = []ZipTest{ var tests = []ZipTest{
ZipTest{ {
Name: "test.zip", Name: "test.zip",
Comment: "This is a zipfile comment.", Comment: "This is a zipfile comment.",
File: []ZipTestFile{ File: []ZipTestFile{
ZipTestFile{ {
Name: "test.txt", Name: "test.txt",
Content: []byte("This is a test text file.\n"), Content: []byte("This is a test text file.\n"),
}, },
ZipTestFile{ {
Name: "gophercolor16x16.png", Name: "gophercolor16x16.png",
File: "gophercolor16x16.png", File: "gophercolor16x16.png",
}, },
}, },
}, },
ZipTest{ {
Name: "r.zip", Name: "r.zip",
File: []ZipTestFile{ File: []ZipTestFile{
ZipTestFile{ {
Name: "r/r.zip", Name: "r/r.zip",
File: "r.zip", File: "r.zip",
}, },
}, },
}, },
ZipTest{Name: "readme.zip"}, {Name: "readme.zip"},
ZipTest{Name: "readme.notzip", Error: FormatError}, {Name: "readme.notzip", Error: FormatError},
} }
func TestReader(t *testing.T) { func TestReader(t *testing.T) {
......
This diff is collapsed.
...@@ -58,32 +58,32 @@ type marshalTest struct { ...@@ -58,32 +58,32 @@ type marshalTest struct {
} }
var marshalTests = []marshalTest{ var marshalTests = []marshalTest{
marshalTest{10, "02010a"}, {10, "02010a"},
marshalTest{127, "02017f"}, {127, "02017f"},
marshalTest{128, "02020080"}, {128, "02020080"},
marshalTest{-128, "020180"}, {-128, "020180"},
marshalTest{-129, "0202ff7f"}, {-129, "0202ff7f"},
marshalTest{intStruct{64}, "3003020140"}, {intStruct{64}, "3003020140"},
marshalTest{twoIntStruct{64, 65}, "3006020140020141"}, {twoIntStruct{64, 65}, "3006020140020141"},
marshalTest{nestedStruct{intStruct{127}}, "3005300302017f"}, {nestedStruct{intStruct{127}}, "3005300302017f"},
marshalTest{[]byte{1, 2, 3}, "0403010203"}, {[]byte{1, 2, 3}, "0403010203"},
marshalTest{implicitTagTest{64}, "3003850140"}, {implicitTagTest{64}, "3003850140"},
marshalTest{explicitTagTest{64}, "3005a503020140"}, {explicitTagTest{64}, "3005a503020140"},
marshalTest{time.SecondsToUTC(0), "170d3730303130313030303030305a"}, {time.SecondsToUTC(0), "170d3730303130313030303030305a"},
marshalTest{time.SecondsToUTC(1258325776), "170d3039313131353232353631365a"}, {time.SecondsToUTC(1258325776), "170d3039313131353232353631365a"},
marshalTest{setPST(time.SecondsToUTC(1258325776)), "17113039313131353232353631362d30383030"}, {setPST(time.SecondsToUTC(1258325776)), "17113039313131353232353631362d30383030"},
marshalTest{BitString{[]byte{0x80}, 1}, "03020780"}, {BitString{[]byte{0x80}, 1}, "03020780"},
marshalTest{BitString{[]byte{0x81, 0xf0}, 12}, "03030481f0"}, {BitString{[]byte{0x81, 0xf0}, 12}, "03030481f0"},
marshalTest{ObjectIdentifier([]int{1, 2, 3, 4}), "06032a0304"}, {ObjectIdentifier([]int{1, 2, 3, 4}), "06032a0304"},
marshalTest{ObjectIdentifier([]int{1, 2, 840, 133549, 1, 1, 5}), "06092a864888932d010105"}, {ObjectIdentifier([]int{1, 2, 840, 133549, 1, 1, 5}), "06092a864888932d010105"},
marshalTest{"test", "130474657374"}, {"test", "130474657374"},
marshalTest{ia5StringTest{"test"}, "3006160474657374"}, {ia5StringTest{"test"}, "3006160474657374"},
marshalTest{printableStringTest{"test"}, "3006130474657374"}, {printableStringTest{"test"}, "3006130474657374"},
marshalTest{printableStringTest{"test*"}, "30071305746573742a"}, {printableStringTest{"test*"}, "30071305746573742a"},
marshalTest{rawContentsStruct{nil, 64}, "3003020140"}, {rawContentsStruct{nil, 64}, "3003020140"},
marshalTest{rawContentsStruct{[]byte{0x30, 3, 1, 2, 3}, 64}, "3003010203"}, {rawContentsStruct{[]byte{0x30, 3, 1, 2, 3}, 64}, "3003010203"},
marshalTest{RawValue{Tag: 1, Class: 2, IsCompound: false, Bytes: []byte{1, 2, 3}}, "8103010203"}, {RawValue{Tag: 1, Class: 2, IsCompound: false, Bytes: []byte{1, 2, 3}}, "8103010203"},
marshalTest{testSET([]int{10}), "310302010a"}, {testSET([]int{10}), "310302010a"},
} }
func TestMarshal(t *testing.T) { func TestMarshal(t *testing.T) {
......
...@@ -13,17 +13,17 @@ type argWW struct { ...@@ -13,17 +13,17 @@ type argWW struct {
} }
var sumWW = []argWW{ var sumWW = []argWW{
argWW{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
argWW{0, 1, 0, 0, 1}, {0, 1, 0, 0, 1},
argWW{0, 0, 1, 0, 1}, {0, 0, 1, 0, 1},
argWW{0, 1, 1, 0, 2}, {0, 1, 1, 0, 2},
argWW{12345, 67890, 0, 0, 80235}, {12345, 67890, 0, 0, 80235},
argWW{12345, 67890, 1, 0, 80236}, {12345, 67890, 1, 0, 80236},
argWW{_M, 1, 0, 1, 0}, {_M, 1, 0, 1, 0},
argWW{_M, 0, 1, 1, 0}, {_M, 0, 1, 1, 0},
argWW{_M, 1, 1, 1, 1}, {_M, 1, 1, 1, 1},
argWW{_M, _M, 0, 1, _M - 1}, {_M, _M, 0, 1, _M - 1},
argWW{_M, _M, 1, 1, _M}, {_M, _M, 1, 1, _M},
} }
...@@ -59,15 +59,15 @@ type argVV struct { ...@@ -59,15 +59,15 @@ type argVV struct {
} }
var sumVV = []argVV{ var sumVV = []argVV{
argVV{}, {},
argVV{nat{0}, nat{0}, nat{0}, 0}, {nat{0}, nat{0}, nat{0}, 0},
argVV{nat{1}, nat{1}, nat{0}, 0}, {nat{1}, nat{1}, nat{0}, 0},
argVV{nat{0}, nat{_M}, nat{1}, 1}, {nat{0}, nat{_M}, nat{1}, 1},
argVV{nat{80235}, nat{12345}, nat{67890}, 0}, {nat{80235}, nat{12345}, nat{67890}, 0},
argVV{nat{_M - 1}, nat{_M}, nat{_M}, 1}, {nat{_M - 1}, nat{_M}, nat{_M}, 1},
argVV{nat{0, 0, 0, 0}, nat{_M, _M, _M, _M}, nat{1, 0, 0, 0}, 1}, {nat{0, 0, 0, 0}, nat{_M, _M, _M, _M}, nat{1, 0, 0, 0}, 1},
argVV{nat{0, 0, 0, _M}, nat{_M, _M, _M, _M - 1}, nat{1, 0, 0, 0}, 0}, {nat{0, 0, 0, _M}, nat{_M, _M, _M, _M - 1}, nat{1, 0, 0, 0}, 0},
argVV{nat{0, 0, 0, 0}, nat{_M, 0, _M, 0}, nat{1, _M, 0, _M}, 1}, {nat{0, 0, 0, 0}, nat{_M, 0, _M, 0}, nat{1, _M, 0, _M}, 1},
} }
...@@ -115,57 +115,57 @@ type argVW struct { ...@@ -115,57 +115,57 @@ type argVW struct {
} }
var sumVW = []argVW{ var sumVW = []argVW{
argVW{}, {},
argVW{nat{0}, nat{0}, 0, 0}, {nat{0}, nat{0}, 0, 0},
argVW{nat{1}, nat{0}, 1, 0}, {nat{1}, nat{0}, 1, 0},
argVW{nat{1}, nat{1}, 0, 0}, {nat{1}, nat{1}, 0, 0},
argVW{nat{0}, nat{_M}, 1, 1}, {nat{0}, nat{_M}, 1, 1},
argVW{nat{0, 0, 0, 0}, nat{_M, _M, _M, _M}, 1, 1}, {nat{0, 0, 0, 0}, nat{_M, _M, _M, _M}, 1, 1},
} }
var prodVW = []argVW{ var prodVW = []argVW{
argVW{}, {},
argVW{nat{0}, nat{0}, 0, 0}, {nat{0}, nat{0}, 0, 0},
argVW{nat{0}, nat{_M}, 0, 0}, {nat{0}, nat{_M}, 0, 0},
argVW{nat{0}, nat{0}, _M, 0}, {nat{0}, nat{0}, _M, 0},
argVW{nat{1}, nat{1}, 1, 0}, {nat{1}, nat{1}, 1, 0},
argVW{nat{22793}, nat{991}, 23, 0}, {nat{22793}, nat{991}, 23, 0},
argVW{nat{0, 0, 0, 22793}, nat{0, 0, 0, 991}, 23, 0}, {nat{0, 0, 0, 22793}, nat{0, 0, 0, 991}, 23, 0},
argVW{nat{0, 0, 0, 0}, nat{7893475, 7395495, 798547395, 68943}, 0, 0}, {nat{0, 0, 0, 0}, nat{7893475, 7395495, 798547395, 68943}, 0, 0},
argVW{nat{0, 0, 0, 0}, nat{0, 0, 0, 0}, 894375984, 0}, {nat{0, 0, 0, 0}, nat{0, 0, 0, 0}, 894375984, 0},
argVW{nat{_M << 1 & _M}, nat{_M}, 1 << 1, _M >> (_W - 1)}, {nat{_M << 1 & _M}, nat{_M}, 1 << 1, _M >> (_W - 1)},
argVW{nat{_M << 7 & _M}, nat{_M}, 1 << 7, _M >> (_W - 7)}, {nat{_M << 7 & _M}, nat{_M}, 1 << 7, _M >> (_W - 7)},
argVW{nat{_M << 7 & _M, _M, _M, _M}, nat{_M, _M, _M, _M}, 1 << 7, _M >> (_W - 7)}, {nat{_M << 7 & _M, _M, _M, _M}, nat{_M, _M, _M, _M}, 1 << 7, _M >> (_W - 7)},
} }
var lshVW = []argVW{ var lshVW = []argVW{
argVW{}, {},
argVW{nat{0}, nat{0}, 0, 0}, {nat{0}, nat{0}, 0, 0},
argVW{nat{0}, nat{0}, 1, 0}, {nat{0}, nat{0}, 1, 0},
argVW{nat{0}, nat{0}, 20, 0}, {nat{0}, nat{0}, 20, 0},
argVW{nat{_M}, nat{_M}, 0, 0}, {nat{_M}, nat{_M}, 0, 0},
argVW{nat{_M << 1 & _M}, nat{_M}, 1, 1}, {nat{_M << 1 & _M}, nat{_M}, 1, 1},
argVW{nat{_M << 20 & _M}, nat{_M}, 20, _M >> (_W - 20)}, {nat{_M << 20 & _M}, nat{_M}, 20, _M >> (_W - 20)},
argVW{nat{_M, _M, _M}, nat{_M, _M, _M}, 0, 0}, {nat{_M, _M, _M}, nat{_M, _M, _M}, 0, 0},
argVW{nat{_M << 1 & _M, _M, _M}, nat{_M, _M, _M}, 1, 1}, {nat{_M << 1 & _M, _M, _M}, nat{_M, _M, _M}, 1, 1},
argVW{nat{_M << 20 & _M, _M, _M}, nat{_M, _M, _M}, 20, _M >> (_W - 20)}, {nat{_M << 20 & _M, _M, _M}, nat{_M, _M, _M}, 20, _M >> (_W - 20)},
} }
var rshVW = []argVW{ var rshVW = []argVW{
argVW{}, {},
argVW{nat{0}, nat{0}, 0, 0}, {nat{0}, nat{0}, 0, 0},
argVW{nat{0}, nat{0}, 1, 0}, {nat{0}, nat{0}, 1, 0},
argVW{nat{0}, nat{0}, 20, 0}, {nat{0}, nat{0}, 20, 0},
argVW{nat{_M}, nat{_M}, 0, 0}, {nat{_M}, nat{_M}, 0, 0},
argVW{nat{_M >> 1}, nat{_M}, 1, _M << (_W - 1) & _M}, {nat{_M >> 1}, nat{_M}, 1, _M << (_W - 1) & _M},
argVW{nat{_M >> 20}, nat{_M}, 20, _M << (_W - 20) & _M}, {nat{_M >> 20}, nat{_M}, 20, _M << (_W - 20) & _M},
argVW{nat{_M, _M, _M}, nat{_M, _M, _M}, 0, 0}, {nat{_M, _M, _M}, nat{_M, _M, _M}, 0, 0},
argVW{nat{_M, _M, _M >> 1}, nat{_M, _M, _M}, 1, _M << (_W - 1) & _M}, {nat{_M, _M, _M >> 1}, nat{_M, _M, _M}, 1, _M << (_W - 1) & _M},
argVW{nat{_M, _M, _M >> 20}, nat{_M, _M, _M}, 20, _M << (_W - 20) & _M}, {nat{_M, _M, _M >> 20}, nat{_M, _M, _M}, 20, _M << (_W - 20) & _M},
} }
...@@ -217,29 +217,29 @@ type argVWW struct { ...@@ -217,29 +217,29 @@ type argVWW struct {
} }
var prodVWW = []argVWW{ var prodVWW = []argVWW{
argVWW{}, {},
argVWW{nat{0}, nat{0}, 0, 0, 0}, {nat{0}, nat{0}, 0, 0, 0},
argVWW{nat{991}, nat{0}, 0, 991, 0}, {nat{991}, nat{0}, 0, 991, 0},
argVWW{nat{0}, nat{_M}, 0, 0, 0}, {nat{0}, nat{_M}, 0, 0, 0},
argVWW{nat{991}, nat{_M}, 0, 991, 0}, {nat{991}, nat{_M}, 0, 991, 0},
argVWW{nat{0}, nat{0}, _M, 0, 0}, {nat{0}, nat{0}, _M, 0, 0},
argVWW{nat{991}, nat{0}, _M, 991, 0}, {nat{991}, nat{0}, _M, 991, 0},
argVWW{nat{1}, nat{1}, 1, 0, 0}, {nat{1}, nat{1}, 1, 0, 0},
argVWW{nat{992}, nat{1}, 1, 991, 0}, {nat{992}, nat{1}, 1, 991, 0},
argVWW{nat{22793}, nat{991}, 23, 0, 0}, {nat{22793}, nat{991}, 23, 0, 0},
argVWW{nat{22800}, nat{991}, 23, 7, 0}, {nat{22800}, nat{991}, 23, 7, 0},
argVWW{nat{0, 0, 0, 22793}, nat{0, 0, 0, 991}, 23, 0, 0}, {nat{0, 0, 0, 22793}, nat{0, 0, 0, 991}, 23, 0, 0},
argVWW{nat{7, 0, 0, 22793}, nat{0, 0, 0, 991}, 23, 7, 0}, {nat{7, 0, 0, 22793}, nat{0, 0, 0, 991}, 23, 7, 0},
argVWW{nat{0, 0, 0, 0}, nat{7893475, 7395495, 798547395, 68943}, 0, 0, 0}, {nat{0, 0, 0, 0}, nat{7893475, 7395495, 798547395, 68943}, 0, 0, 0},
argVWW{nat{991, 0, 0, 0}, nat{7893475, 7395495, 798547395, 68943}, 0, 991, 0}, {nat{991, 0, 0, 0}, nat{7893475, 7395495, 798547395, 68943}, 0, 991, 0},
argVWW{nat{0, 0, 0, 0}, nat{0, 0, 0, 0}, 894375984, 0, 0}, {nat{0, 0, 0, 0}, nat{0, 0, 0, 0}, 894375984, 0, 0},
argVWW{nat{991, 0, 0, 0}, nat{0, 0, 0, 0}, 894375984, 991, 0}, {nat{991, 0, 0, 0}, nat{0, 0, 0, 0}, 894375984, 991, 0},
argVWW{nat{_M << 1 & _M}, nat{_M}, 1 << 1, 0, _M >> (_W - 1)}, {nat{_M << 1 & _M}, nat{_M}, 1 << 1, 0, _M >> (_W - 1)},
argVWW{nat{_M<<1&_M + 1}, nat{_M}, 1 << 1, 1, _M >> (_W - 1)}, {nat{_M<<1&_M + 1}, nat{_M}, 1 << 1, 1, _M >> (_W - 1)},
argVWW{nat{_M << 7 & _M}, nat{_M}, 1 << 7, 0, _M >> (_W - 7)}, {nat{_M << 7 & _M}, nat{_M}, 1 << 7, 0, _M >> (_W - 7)},
argVWW{nat{_M<<7&_M + 1<<6}, nat{_M}, 1 << 7, 1 << 6, _M >> (_W - 7)}, {nat{_M<<7&_M + 1<<6}, nat{_M}, 1 << 7, 1 << 6, _M >> (_W - 7)},
argVWW{nat{_M << 7 & _M, _M, _M, _M}, nat{_M, _M, _M, _M}, 1 << 7, 0, _M >> (_W - 7)}, {nat{_M << 7 & _M, _M, _M, _M}, nat{_M, _M, _M, _M}, 1 << 7, 0, _M >> (_W - 7)},
argVWW{nat{_M<<7&_M + 1<<6, _M, _M, _M}, nat{_M, _M, _M, _M}, 1 << 7, 1 << 6, _M >> (_W - 7)}, {nat{_M<<7&_M + 1<<6, _M, _M, _M}, nat{_M, _M, _M, _M}, 1 << 7, 1 << 6, _M >> (_W - 7)},
} }
...@@ -307,7 +307,7 @@ type mulWWTest struct { ...@@ -307,7 +307,7 @@ type mulWWTest struct {
var mulWWTests = []mulWWTest{ var mulWWTests = []mulWWTest{
mulWWTest{_M, _M, _M - 1, 1}, {_M, _M, _M - 1, 1},
// 32 bit only: mulWWTest{0xc47dfa8c, 50911, 0x98a4, 0x998587f4}, // 32 bit only: mulWWTest{0xc47dfa8c, 50911, 0x98a4, 0x998587f4},
} }
...@@ -332,8 +332,8 @@ var mulAddWWWTests = []mulAddWWWTest{ ...@@ -332,8 +332,8 @@ var mulAddWWWTests = []mulAddWWWTest{
// TODO(agl): These will only work on 64-bit platforms. // TODO(agl): These will only work on 64-bit platforms.
// mulAddWWWTest{15064310297182388543, 0xe7df04d2d35d5d80, 13537600649892366549, 13644450054494335067, 10832252001440893781}, // mulAddWWWTest{15064310297182388543, 0xe7df04d2d35d5d80, 13537600649892366549, 13644450054494335067, 10832252001440893781},
// mulAddWWWTest{15064310297182388543, 0xdab2f18048baa68d, 13644450054494335067, 12869334219691522700, 14233854684711418382}, // mulAddWWWTest{15064310297182388543, 0xdab2f18048baa68d, 13644450054494335067, 12869334219691522700, 14233854684711418382},
mulAddWWWTest{_M, _M, 0, _M - 1, 1}, {_M, _M, 0, _M - 1, 1},
mulAddWWWTest{_M, _M, _M, _M, 0}, {_M, _M, _M, _M, 0},
} }
......
This diff is collapsed.
...@@ -13,20 +13,20 @@ type cmpTest struct { ...@@ -13,20 +13,20 @@ type cmpTest struct {
var cmpTests = []cmpTest{ var cmpTests = []cmpTest{
cmpTest{nil, nil, 0}, {nil, nil, 0},
cmpTest{nil, nat{}, 0}, {nil, nat{}, 0},
cmpTest{nat{}, nil, 0}, {nat{}, nil, 0},
cmpTest{nat{}, nat{}, 0}, {nat{}, nat{}, 0},
cmpTest{nat{0}, nat{0}, 0}, {nat{0}, nat{0}, 0},
cmpTest{nat{0}, nat{1}, -1}, {nat{0}, nat{1}, -1},
cmpTest{nat{1}, nat{0}, 1}, {nat{1}, nat{0}, 1},
cmpTest{nat{1}, nat{1}, 0}, {nat{1}, nat{1}, 0},
cmpTest{nat{0, _M}, nat{1}, 1}, {nat{0, _M}, nat{1}, 1},
cmpTest{nat{1}, nat{0, _M}, -1}, {nat{1}, nat{0, _M}, -1},
cmpTest{nat{1, _M}, nat{0, _M}, 1}, {nat{1, _M}, nat{0, _M}, 1},
cmpTest{nat{0, _M}, nat{1, _M}, -1}, {nat{0, _M}, nat{1, _M}, -1},
cmpTest{nat{16, 571956, 8794, 68}, nat{837, 9146, 1, 754489}, -1}, {nat{16, 571956, 8794, 68}, nat{837, 9146, 1, 754489}, -1},
cmpTest{nat{34986, 41, 105, 1957}, nat{56, 7458, 104, 1957}, 1}, {nat{34986, 41, 105, 1957}, nat{56, 7458, 104, 1957}, 1},
} }
...@@ -47,24 +47,24 @@ type argNN struct { ...@@ -47,24 +47,24 @@ type argNN struct {
var sumNN = []argNN{ var sumNN = []argNN{
argNN{}, {},
argNN{nat{1}, nil, nat{1}}, {nat{1}, nil, nat{1}},
argNN{nat{1111111110}, nat{123456789}, nat{987654321}}, {nat{1111111110}, nat{123456789}, nat{987654321}},
argNN{nat{0, 0, 0, 1}, nil, nat{0, 0, 0, 1}}, {nat{0, 0, 0, 1}, nil, nat{0, 0, 0, 1}},
argNN{nat{0, 0, 0, 1111111110}, nat{0, 0, 0, 123456789}, nat{0, 0, 0, 987654321}}, {nat{0, 0, 0, 1111111110}, nat{0, 0, 0, 123456789}, nat{0, 0, 0, 987654321}},
argNN{nat{0, 0, 0, 1}, nat{0, 0, _M}, nat{0, 0, 1}}, {nat{0, 0, 0, 1}, nat{0, 0, _M}, nat{0, 0, 1}},
} }
var prodNN = []argNN{ var prodNN = []argNN{
argNN{}, {},
argNN{nil, nil, nil}, {nil, nil, nil},
argNN{nil, nat{991}, nil}, {nil, nat{991}, nil},
argNN{nat{991}, nat{991}, nat{1}}, {nat{991}, nat{991}, nat{1}},
argNN{nat{991 * 991}, nat{991}, nat{991}}, {nat{991 * 991}, nat{991}, nat{991}},
argNN{nat{0, 0, 991 * 991}, nat{0, 991}, nat{0, 991}}, {nat{0, 0, 991 * 991}, nat{0, 991}, nat{0, 991}},
argNN{nat{1 * 991, 2 * 991, 3 * 991, 4 * 991}, nat{1, 2, 3, 4}, nat{991}}, {nat{1 * 991, 2 * 991, 3 * 991, 4 * 991}, nat{1, 2, 3, 4}, nat{991}},
argNN{nat{4, 11, 20, 30, 20, 11, 4}, nat{1, 2, 3, 4}, nat{4, 3, 2, 1}}, {nat{4, 11, 20, 30, 20, 11, 4}, nat{1, 2, 3, 4}, nat{4, 3, 2, 1}},
} }
...@@ -118,18 +118,18 @@ type mulRangeN struct { ...@@ -118,18 +118,18 @@ type mulRangeN struct {
var mulRangesN = []mulRangeN{ var mulRangesN = []mulRangeN{
mulRangeN{0, 0, "0"}, {0, 0, "0"},
mulRangeN{1, 1, "1"}, {1, 1, "1"},
mulRangeN{1, 2, "2"}, {1, 2, "2"},
mulRangeN{1, 3, "6"}, {1, 3, "6"},
mulRangeN{10, 10, "10"}, {10, 10, "10"},
mulRangeN{0, 100, "0"}, {0, 100, "0"},
mulRangeN{0, 1e9, "0"}, {0, 1e9, "0"},
mulRangeN{1, 0, "1"}, // empty range {1, 0, "1"}, // empty range
mulRangeN{100, 1, "1"}, // empty range {100, 1, "1"}, // empty range
mulRangeN{1, 10, "3628800"}, // 10! {1, 10, "3628800"}, // 10!
mulRangeN{1, 20, "2432902008176640000"}, // 20! {1, 20, "2432902008176640000"}, // 20!
mulRangeN{1, 100, {1, 100,
"933262154439441526816992388562667004907159682643816214685929" + "933262154439441526816992388562667004907159682643816214685929" +
"638952175999932299156089414639761565182862536979208272237582" + "638952175999932299156089414639761565182862536979208272237582" +
"51185210916864000000000000000000000000", // 100! "51185210916864000000000000000000000000", // 100!
...@@ -181,10 +181,10 @@ type str struct { ...@@ -181,10 +181,10 @@ type str struct {
var tab = []str{ var tab = []str{
str{nil, 10, "0"}, {nil, 10, "0"},
str{nat{1}, 10, "1"}, {nat{1}, 10, "1"},
str{nat{10}, 10, "10"}, {nat{10}, 10, "10"},
str{nat{1234567890}, 10, "1234567890"}, {nat{1234567890}, 10, "1234567890"},
} }
...@@ -228,12 +228,12 @@ type shiftTest struct { ...@@ -228,12 +228,12 @@ type shiftTest struct {
var leftShiftTests = []shiftTest{ var leftShiftTests = []shiftTest{
shiftTest{nil, 0, nil}, {nil, 0, nil},
shiftTest{nil, 1, nil}, {nil, 1, nil},
shiftTest{natOne, 0, natOne}, {natOne, 0, natOne},
shiftTest{natOne, 1, natTwo}, {natOne, 1, natTwo},
shiftTest{nat{1 << (_W - 1)}, 1, nat{0}}, {nat{1 << (_W - 1)}, 1, nat{0}},
shiftTest{nat{1 << (_W - 1), 0}, 1, nat{0, 1}}, {nat{1 << (_W - 1), 0}, 1, nat{0, 1}},
} }
...@@ -252,13 +252,13 @@ func TestShiftLeft(t *testing.T) { ...@@ -252,13 +252,13 @@ func TestShiftLeft(t *testing.T) {
var rightShiftTests = []shiftTest{ var rightShiftTests = []shiftTest{
shiftTest{nil, 0, nil}, {nil, 0, nil},
shiftTest{nil, 1, nil}, {nil, 1, nil},
shiftTest{natOne, 0, natOne}, {natOne, 0, natOne},
shiftTest{natOne, 1, nil}, {natOne, 1, nil},
shiftTest{natTwo, 1, natOne}, {natTwo, 1, natOne},
shiftTest{nat{0, 1}, 1, nat{1 << (_W - 1)}}, {nat{0, 1}, 1, nat{1 << (_W - 1)}},
shiftTest{nat{2, 1, 1}, 1, nat{1<<(_W-1) + 1, 1 << (_W - 1)}}, {nat{2, 1, 1}, 1, nat{1<<(_W-1) + 1, 1 << (_W - 1)}},
} }
...@@ -284,12 +284,12 @@ type modWTest struct { ...@@ -284,12 +284,12 @@ type modWTest struct {
var modWTests32 = []modWTest{ var modWTests32 = []modWTest{
modWTest{"23492635982634928349238759823742", "252341", "220170"}, {"23492635982634928349238759823742", "252341", "220170"},
} }
var modWTests64 = []modWTest{ var modWTests64 = []modWTest{
modWTest{"6527895462947293856291561095690465243862946", "524326975699234", "375066989628668"}, {"6527895462947293856291561095690465243862946", "524326975699234", "375066989628668"},
} }
...@@ -336,12 +336,12 @@ type expNNTest struct { ...@@ -336,12 +336,12 @@ type expNNTest struct {
var expNNTests = []expNNTest{ var expNNTests = []expNNTest{
expNNTest{"0x8000000000000000", "2", "", "0x40000000000000000000000000000000"}, {"0x8000000000000000", "2", "", "0x40000000000000000000000000000000"},
expNNTest{"0x8000000000000000", "2", "6719", "4944"}, {"0x8000000000000000", "2", "6719", "4944"},
expNNTest{"0x8000000000000000", "3", "6719", "5447"}, {"0x8000000000000000", "3", "6719", "5447"},
expNNTest{"0x8000000000000000", "1000", "6719", "1603"}, {"0x8000000000000000", "1000", "6719", "1603"},
expNNTest{"0x8000000000000000", "1000000", "6719", "3199"}, {"0x8000000000000000", "1000000", "6719", "3199"},
expNNTest{ {
"2938462938472983472983659726349017249287491026512746239764525612965293865296239471239874193284792387498274256129746192347", "2938462938472983472983659726349017249287491026512746239764525612965293865296239471239874193284792387498274256129746192347",
"298472983472983471903246121093472394872319615612417471234712061", "298472983472983471903246121093472394872319615612417471234712061",
"29834729834729834729347290846729561262544958723956495615629569234729836259263598127342374289365912465901365498236492183464", "29834729834729834729347290846729561262544958723956495615629569234729836259263598127342374289365912465901365498236492183464",
......
...@@ -13,35 +13,35 @@ type setStringTest struct { ...@@ -13,35 +13,35 @@ type setStringTest struct {
} }
var setStringTests = []setStringTest{ var setStringTests = []setStringTest{
setStringTest{"0", "0", true}, {"0", "0", true},
setStringTest{"-0", "0", true}, {"-0", "0", true},
setStringTest{"1", "1", true}, {"1", "1", true},
setStringTest{"-1", "-1", true}, {"-1", "-1", true},
setStringTest{"1.", "1", true}, {"1.", "1", true},
setStringTest{"1e0", "1", true}, {"1e0", "1", true},
setStringTest{"1.e1", "10", true}, {"1.e1", "10", true},
setStringTest{in: "1e", ok: false}, {in: "1e", ok: false},
setStringTest{in: "1.e", ok: false}, {in: "1.e", ok: false},
setStringTest{in: "1e+14e-5", ok: false}, {in: "1e+14e-5", ok: false},
setStringTest{in: "1e4.5", ok: false}, {in: "1e4.5", ok: false},
setStringTest{in: "r", ok: false}, {in: "r", ok: false},
setStringTest{in: "a/b", ok: false}, {in: "a/b", ok: false},
setStringTest{in: "a.b", ok: false}, {in: "a.b", ok: false},
setStringTest{"-0.1", "-1/10", true}, {"-0.1", "-1/10", true},
setStringTest{"-.1", "-1/10", true}, {"-.1", "-1/10", true},
setStringTest{"2/4", "1/2", true}, {"2/4", "1/2", true},
setStringTest{".25", "1/4", true}, {".25", "1/4", true},
setStringTest{"-1/5", "-1/5", true}, {"-1/5", "-1/5", true},
setStringTest{"8129567.7690E14", "812956776900000000000", true}, {"8129567.7690E14", "812956776900000000000", true},
setStringTest{"78189e+4", "781890000", true}, {"78189e+4", "781890000", true},
setStringTest{"553019.8935e+8", "55301989350000", true}, {"553019.8935e+8", "55301989350000", true},
setStringTest{"98765432109876543210987654321e-10", "98765432109876543210987654321/10000000000", true}, {"98765432109876543210987654321e-10", "98765432109876543210987654321/10000000000", true},
setStringTest{"9877861857500000E-7", "3951144743/4", true}, {"9877861857500000E-7", "3951144743/4", true},
setStringTest{"2169378.417e-3", "2169378417/1000000", true}, {"2169378.417e-3", "2169378417/1000000", true},
setStringTest{"884243222337379604041632732738665534", "884243222337379604041632732738665534", true}, {"884243222337379604041632732738665534", "884243222337379604041632732738665534", true},
setStringTest{"53/70893980658822810696", "53/70893980658822810696", true}, {"53/70893980658822810696", "53/70893980658822810696", true},
setStringTest{"106/141787961317645621392", "53/70893980658822810696", true}, {"106/141787961317645621392", "53/70893980658822810696", true},
setStringTest{"204211327800791583.81095", "4084226556015831676219/20000", true}, {"204211327800791583.81095", "4084226556015831676219/20000", true},
} }
func TestRatSetString(t *testing.T) { func TestRatSetString(t *testing.T) {
...@@ -62,20 +62,20 @@ type floatStringTest struct { ...@@ -62,20 +62,20 @@ type floatStringTest struct {
} }
var floatStringTests = []floatStringTest{ var floatStringTests = []floatStringTest{
floatStringTest{"0", 0, "0"}, {"0", 0, "0"},
floatStringTest{"0", 4, "0"}, {"0", 4, "0"},
floatStringTest{"1", 0, "1"}, {"1", 0, "1"},
floatStringTest{"1", 2, "1"}, {"1", 2, "1"},
floatStringTest{"-1", 0, "-1"}, {"-1", 0, "-1"},
floatStringTest{".25", 2, "0.25"}, {".25", 2, "0.25"},
floatStringTest{".25", 1, "0.3"}, {".25", 1, "0.3"},
floatStringTest{"-1/3", 3, "-0.333"}, {"-1/3", 3, "-0.333"},
floatStringTest{"-2/3", 4, "-0.6667"}, {"-2/3", 4, "-0.6667"},
floatStringTest{"0.96", 1, "1.0"}, {"0.96", 1, "1.0"},
floatStringTest{"0.999", 2, "1.00"}, {"0.999", 2, "1.00"},
floatStringTest{"0.9", 0, "1"}, {"0.9", 0, "1"},
floatStringTest{".25", -1, "0"}, {".25", -1, "0"},
floatStringTest{".55", -1, "1"}, {".55", -1, "1"},
} }
func TestFloatString(t *testing.T) { func TestFloatString(t *testing.T) {
...@@ -109,15 +109,15 @@ type ratCmpTest struct { ...@@ -109,15 +109,15 @@ type ratCmpTest struct {
} }
var ratCmpTests = []ratCmpTest{ var ratCmpTests = []ratCmpTest{
ratCmpTest{"0", "0/1", 0}, {"0", "0/1", 0},
ratCmpTest{"1/1", "1", 0}, {"1/1", "1", 0},
ratCmpTest{"-1", "-2/2", 0}, {"-1", "-2/2", 0},
ratCmpTest{"1", "0", 1}, {"1", "0", 1},
ratCmpTest{"0/1", "1/1", -1}, {"0/1", "1/1", -1},
ratCmpTest{"-5/1434770811533343057144", "-5/1434770811533343057145", -1}, {"-5/1434770811533343057144", "-5/1434770811533343057145", -1},
ratCmpTest{"49832350382626108453/8964749413", "49832350382626108454/8964749413", -1}, {"49832350382626108453/8964749413", "49832350382626108454/8964749413", -1},
ratCmpTest{"-37414950961700930/7204075375675961", "37414950961700930/7204075375675961", -1}, {"-37414950961700930/7204075375675961", "37414950961700930/7204075375675961", -1},
ratCmpTest{"37414950961700930/7204075375675961", "74829901923401860/14408150751351922", 0}, {"37414950961700930/7204075375675961", "74829901923401860/14408150751351922", 0},
} }
func TestRatCmp(t *testing.T) { func TestRatCmp(t *testing.T) {
...@@ -188,24 +188,24 @@ type ratBinTest struct { ...@@ -188,24 +188,24 @@ type ratBinTest struct {
} }
var ratBinTests = []ratBinTest{ var ratBinTests = []ratBinTest{
ratBinTest{"0", "0", "0", "0"}, {"0", "0", "0", "0"},
ratBinTest{"0", "1", "1", "0"}, {"0", "1", "1", "0"},
ratBinTest{"-1", "0", "-1", "0"}, {"-1", "0", "-1", "0"},
ratBinTest{"-1", "1", "0", "-1"}, {"-1", "1", "0", "-1"},
ratBinTest{"1", "1", "2", "1"}, {"1", "1", "2", "1"},
ratBinTest{"1/2", "1/2", "1", "1/4"}, {"1/2", "1/2", "1", "1/4"},
ratBinTest{"1/4", "1/3", "7/12", "1/12"}, {"1/4", "1/3", "7/12", "1/12"},
ratBinTest{"2/5", "-14/3", "-64/15", "-28/15"}, {"2/5", "-14/3", "-64/15", "-28/15"},
ratBinTest{"4707/49292519774798173060", "-3367/70976135186689855734", "84058377121001851123459/1749296273614329067191168098769082663020", "-1760941/388732505247628681598037355282018369560"}, {"4707/49292519774798173060", "-3367/70976135186689855734", "84058377121001851123459/1749296273614329067191168098769082663020", "-1760941/388732505247628681598037355282018369560"},
ratBinTest{"-61204110018146728334/3", "-31052192278051565633/2", "-215564796870448153567/6", "950260896245257153059642991192710872711/3"}, {"-61204110018146728334/3", "-31052192278051565633/2", "-215564796870448153567/6", "950260896245257153059642991192710872711/3"},
ratBinTest{"-854857841473707320655/4237645934602118692642972629634714039", "-18/31750379913563777419", "-27/133467566250814981", "15387441146526731771790/134546868362786310073779084329032722548987800600710485341"}, {"-854857841473707320655/4237645934602118692642972629634714039", "-18/31750379913563777419", "-27/133467566250814981", "15387441146526731771790/134546868362786310073779084329032722548987800600710485341"},
ratBinTest{"618575745270541348005638912139/19198433543745179392300736", "-19948846211000086/637313996471", "27674141753240653/30123979153216", "-6169936206128396568797607742807090270137721977/6117715203873571641674006593837351328"}, {"618575745270541348005638912139/19198433543745179392300736", "-19948846211000086/637313996471", "27674141753240653/30123979153216", "-6169936206128396568797607742807090270137721977/6117715203873571641674006593837351328"},
ratBinTest{"-3/26206484091896184128", "5/2848423294177090248", "15310893822118706237/9330894968229805033368778458685147968", "-5/24882386581946146755650075889827061248"}, {"-3/26206484091896184128", "5/2848423294177090248", "15310893822118706237/9330894968229805033368778458685147968", "-5/24882386581946146755650075889827061248"},
ratBinTest{"26946729/330400702820", "41563965/225583428284", "1238218672302860271/4658307703098666660055", "224002580204097/14906584649915733312176"}, {"26946729/330400702820", "41563965/225583428284", "1238218672302860271/4658307703098666660055", "224002580204097/14906584649915733312176"},
ratBinTest{"-8259900599013409474/7", "-84829337473700364773/56707961321161574960", "-468402123685491748914621885145127724451/396955729248131024720", "350340947706464153265156004876107029701/198477864624065512360"}, {"-8259900599013409474/7", "-84829337473700364773/56707961321161574960", "-468402123685491748914621885145127724451/396955729248131024720", "350340947706464153265156004876107029701/198477864624065512360"},
ratBinTest{"575775209696864/1320203974639986246357", "29/712593081308", "410331716733912717985762465/940768218243776489278275419794956", "808/45524274987585732633"}, {"575775209696864/1320203974639986246357", "29/712593081308", "410331716733912717985762465/940768218243776489278275419794956", "808/45524274987585732633"},
ratBinTest{"1786597389946320496771/2066653520653241", "6269770/1992362624741777", "3559549865190272133656109052308126637/4117523232840525481453983149257", "8967230/3296219033"}, {"1786597389946320496771/2066653520653241", "6269770/1992362624741777", "3559549865190272133656109052308126637/4117523232840525481453983149257", "8967230/3296219033"},
ratBinTest{"-36459180403360509753/32150500941194292113930", "9381566963714/9633539", "301622077145533298008420642898530153/309723104686531919656937098270", "-3784609207827/3426986245"}, {"-36459180403360509753/32150500941194292113930", "9381566963714/9633539", "301622077145533298008420642898530153/309723104686531919656937098270", "-3784609207827/3426986245"},
} }
func TestRatBin(t *testing.T) { func TestRatBin(t *testing.T) {
......
...@@ -80,10 +80,10 @@ type readMaker struct { ...@@ -80,10 +80,10 @@ type readMaker struct {
} }
var readMakers = []readMaker{ var readMakers = []readMaker{
readMaker{"full", func(r io.Reader) io.Reader { return r }}, {"full", func(r io.Reader) io.Reader { return r }},
readMaker{"byte", iotest.OneByteReader}, {"byte", iotest.OneByteReader},
readMaker{"half", iotest.HalfReader}, {"half", iotest.HalfReader},
readMaker{"data+err", iotest.DataErrReader}, {"data+err", iotest.DataErrReader},
} }
// Call ReadString (which ends up calling everything else) // Call ReadString (which ends up calling everything else)
...@@ -123,14 +123,14 @@ type bufReader struct { ...@@ -123,14 +123,14 @@ type bufReader struct {
} }
var bufreaders = []bufReader{ var bufreaders = []bufReader{
bufReader{"1", func(b *Reader) string { return reads(b, 1) }}, {"1", func(b *Reader) string { return reads(b, 1) }},
bufReader{"2", func(b *Reader) string { return reads(b, 2) }}, {"2", func(b *Reader) string { return reads(b, 2) }},
bufReader{"3", func(b *Reader) string { return reads(b, 3) }}, {"3", func(b *Reader) string { return reads(b, 3) }},
bufReader{"4", func(b *Reader) string { return reads(b, 4) }}, {"4", func(b *Reader) string { return reads(b, 4) }},
bufReader{"5", func(b *Reader) string { return reads(b, 5) }}, {"5", func(b *Reader) string { return reads(b, 5) }},
bufReader{"7", func(b *Reader) string { return reads(b, 7) }}, {"7", func(b *Reader) string { return reads(b, 7) }},
bufReader{"bytes", readBytes}, {"bytes", readBytes},
bufReader{"lines", readLines}, {"lines", readLines},
} }
var bufsizes = []int{ var bufsizes = []int{
...@@ -210,14 +210,14 @@ func readRuneSegments(t *testing.T, segments []string) { ...@@ -210,14 +210,14 @@ func readRuneSegments(t *testing.T, segments []string) {
} }
var segmentList = [][]string{ var segmentList = [][]string{
[]string{}, {},
[]string{""}, {""},
[]string{"日", "本語"}, {"日", "本語"},
[]string{"\u65e5", "\u672c", "\u8a9e"}, {"\u65e5", "\u672c", "\u8a9e"},
[]string{"\U000065e5", "\U0000672c", "\U00008a9e"}, {"\U000065e5", "\U0000672c", "\U00008a9e"},
[]string{"\xe6", "\x97\xa5\xe6", "\x9c\xac\xe8\xaa\x9e"}, {"\xe6", "\x97\xa5\xe6", "\x9c\xac\xe8\xaa\x9e"},
[]string{"Hello", ", ", "World", "!"}, {"Hello", ", ", "World", "!"},
[]string{"Hello", ", ", "", "World", "!"}, {"Hello", ", ", "", "World", "!"},
} }
func TestReadRune(t *testing.T) { func TestReadRune(t *testing.T) {
...@@ -422,12 +422,12 @@ func (w errorWriterTest) Write(p []byte) (int, os.Error) { ...@@ -422,12 +422,12 @@ func (w errorWriterTest) Write(p []byte) (int, os.Error) {
} }
var errorWriterTests = []errorWriterTest{ var errorWriterTests = []errorWriterTest{
errorWriterTest{0, 1, nil, io.ErrShortWrite}, {0, 1, nil, io.ErrShortWrite},
errorWriterTest{1, 2, nil, io.ErrShortWrite}, {1, 2, nil, io.ErrShortWrite},
errorWriterTest{1, 1, nil, nil}, {1, 1, nil, nil},
errorWriterTest{0, 1, os.EPIPE, os.EPIPE}, {0, 1, os.EPIPE, os.EPIPE},
errorWriterTest{1, 2, os.EPIPE, os.EPIPE}, {1, 2, os.EPIPE, os.EPIPE},
errorWriterTest{1, 1, os.EPIPE, os.EPIPE}, {1, 1, os.EPIPE, os.EPIPE},
} }
func TestWriteErrors(t *testing.T) { func TestWriteErrors(t *testing.T) {
......
This diff is collapsed.
...@@ -203,16 +203,16 @@ type ff struct { ...@@ -203,16 +203,16 @@ type ff struct {
} }
var polar = []ff{ var polar = []ff{
ff{9.2022120669932650313380972e+00, 9.9909115046919291062461269e-01}, {9.2022120669932650313380972e+00, 9.9909115046919291062461269e-01},
ff{7.7438239742296106616261394e+00, -3.5762575021856971295156489e-02}, {7.7438239742296106616261394e+00, -3.5762575021856971295156489e-02},
ff{5.0182478202557746902556648e+00, -1.6259990074019058442232221e+00}, {5.0182478202557746902556648e+00, -1.6259990074019058442232221e+00},
ff{1.0861137372799545160704002e+01, 2.0502936359659111755031062e+00}, {1.0861137372799545160704002e+01, 2.0502936359659111755031062e+00},
ff{1.0070841084922199607011905e+01, 2.9483213155446756211881774e-01}, {1.0070841084922199607011905e+01, 2.9483213155446756211881774e-01},
ff{5.9922447613166942183705192e+00, 1.0605860367252556281902109e+00}, {5.9922447613166942183705192e+00, 1.0605860367252556281902109e+00},
ff{5.8978784056736762299945176e+00, 4.8084556083358307819310911e-01}, {5.8978784056736762299945176e+00, 4.8084556083358307819310911e-01},
ff{3.2822866700678709020367184e+00, 5.8969634164776659423195222e-01}, {3.2822866700678709020367184e+00, 5.8969634164776659423195222e-01},
ff{8.8756430028990417290744307e+00, -1.3636647724582455028314573e+00}, {8.8756430028990417290744307e+00, -1.3636647724582455028314573e+00},
ff{1.0011785496777731986390856e+01, 2.6210913895386013290915234e+00}, {1.0011785496777731986390856e+01, 2.6210913895386013290915234e+00},
} }
var pow = []complex128{ var pow = []complex128{
(-2.499956739197529585028819e+00 + 1.759751724335650228957144e+00i), (-2.499956739197529585028819e+00 + 1.759751724335650228957144e+00i),
...@@ -392,10 +392,10 @@ var vcPolarSC = []complex128{ ...@@ -392,10 +392,10 @@ var vcPolarSC = []complex128{
NaN(), NaN(),
} }
var polarSC = []ff{ var polarSC = []ff{
ff{math.NaN(), math.NaN()}, {math.NaN(), math.NaN()},
} }
var vcPowSC = [][2]complex128{ var vcPowSC = [][2]complex128{
[2]complex128{NaN(), NaN()}, {NaN(), NaN()},
} }
var powSC = []complex128{ var powSC = []complex128{
NaN(), NaN(),
......
...@@ -53,19 +53,19 @@ type compressionLevel struct { ...@@ -53,19 +53,19 @@ type compressionLevel struct {
} }
var levels = []compressionLevel{ var levels = []compressionLevel{
compressionLevel{}, // 0 {}, // 0
// For levels 1-3 we don't bother trying with lazy matches // For levels 1-3 we don't bother trying with lazy matches
compressionLevel{3, 0, 8, 4, 4}, {3, 0, 8, 4, 4},
compressionLevel{3, 0, 16, 8, 5}, {3, 0, 16, 8, 5},
compressionLevel{3, 0, 32, 32, 6}, {3, 0, 32, 32, 6},
// Levels 4-9 use increasingly more lazy matching // Levels 4-9 use increasingly more lazy matching
// and increasingly stringent conditions for "good enough". // and increasingly stringent conditions for "good enough".
compressionLevel{4, 4, 16, 16, math.MaxInt32}, {4, 4, 16, 16, math.MaxInt32},
compressionLevel{8, 16, 32, 32, math.MaxInt32}, {8, 16, 32, 32, math.MaxInt32},
compressionLevel{8, 16, 128, 128, math.MaxInt32}, {8, 16, 128, 128, math.MaxInt32},
compressionLevel{8, 32, 128, 256, math.MaxInt32}, {8, 32, 128, 256, math.MaxInt32},
compressionLevel{32, 128, 258, 1024, math.MaxInt32}, {32, 128, 258, 1024, math.MaxInt32},
compressionLevel{32, 258, 258, 4096, math.MaxInt32}, {32, 258, 258, 4096, math.MaxInt32},
} }
func (sw *syncPipeWriter) Close() os.Error { func (sw *syncPipeWriter) Close() os.Error {
......
...@@ -20,7 +20,7 @@ type gunzipTest struct { ...@@ -20,7 +20,7 @@ type gunzipTest struct {
} }
var gunzipTests = []gunzipTest{ var gunzipTests = []gunzipTest{
gunzipTest{ // has 1 empty fixed-huffman block { // has 1 empty fixed-huffman block
"empty.txt", "empty.txt",
"empty.txt", "empty.txt",
"", "",
...@@ -32,7 +32,7 @@ var gunzipTests = []gunzipTest{ ...@@ -32,7 +32,7 @@ var gunzipTests = []gunzipTest{
}, },
nil, nil,
}, },
gunzipTest{ // has 1 non-empty fixed huffman block { // has 1 non-empty fixed huffman block
"hello.txt", "hello.txt",
"hello.txt", "hello.txt",
"hello world\n", "hello world\n",
...@@ -46,7 +46,7 @@ var gunzipTests = []gunzipTest{ ...@@ -46,7 +46,7 @@ var gunzipTests = []gunzipTest{
}, },
nil, nil,
}, },
gunzipTest{ // concatenation { // concatenation
"hello.txt", "hello.txt",
"hello.txt x2", "hello.txt x2",
"hello world\n" + "hello world\n" +
...@@ -67,7 +67,7 @@ var gunzipTests = []gunzipTest{ ...@@ -67,7 +67,7 @@ var gunzipTests = []gunzipTest{
}, },
nil, nil,
}, },
gunzipTest{ // has a fixed huffman block with some length-distance pairs { // has a fixed huffman block with some length-distance pairs
"shesells.txt", "shesells.txt",
"shesells.txt", "shesells.txt",
"she sells seashells by the seashore\n", "she sells seashells by the seashore\n",
...@@ -83,7 +83,7 @@ var gunzipTests = []gunzipTest{ ...@@ -83,7 +83,7 @@ var gunzipTests = []gunzipTest{
}, },
nil, nil,
}, },
gunzipTest{ // has dynamic huffman blocks { // has dynamic huffman blocks
"gettysburg", "gettysburg",
"gettysburg", "gettysburg",
" Four score and seven years ago our fathers brought forth on\n" + " Four score and seven years ago our fathers brought forth on\n" +
...@@ -221,7 +221,7 @@ var gunzipTests = []gunzipTest{ ...@@ -221,7 +221,7 @@ var gunzipTests = []gunzipTest{
}, },
nil, nil,
}, },
gunzipTest{ // has 1 non-empty fixed huffman block then garbage { // has 1 non-empty fixed huffman block then garbage
"hello.txt", "hello.txt",
"hello.txt + garbage", "hello.txt + garbage",
"hello world\n", "hello world\n",
...@@ -235,7 +235,7 @@ var gunzipTests = []gunzipTest{ ...@@ -235,7 +235,7 @@ var gunzipTests = []gunzipTest{
}, },
HeaderError, HeaderError,
}, },
gunzipTest{ // has 1 non-empty fixed huffman block not enough header { // has 1 non-empty fixed huffman block not enough header
"hello.txt", "hello.txt",
"hello.txt + garbage", "hello.txt + garbage",
"hello world\n", "hello world\n",
...@@ -249,7 +249,7 @@ var gunzipTests = []gunzipTest{ ...@@ -249,7 +249,7 @@ var gunzipTests = []gunzipTest{
}, },
io.ErrUnexpectedEOF, io.ErrUnexpectedEOF,
}, },
gunzipTest{ // has 1 non-empty fixed huffman block but corrupt checksum { // has 1 non-empty fixed huffman block but corrupt checksum
"hello.txt", "hello.txt",
"hello.txt + corrupt checksum", "hello.txt + corrupt checksum",
"hello world\n", "hello world\n",
...@@ -263,7 +263,7 @@ var gunzipTests = []gunzipTest{ ...@@ -263,7 +263,7 @@ var gunzipTests = []gunzipTest{
}, },
ChecksumError, ChecksumError,
}, },
gunzipTest{ // has 1 non-empty fixed huffman block but corrupt size { // has 1 non-empty fixed huffman block but corrupt size
"hello.txt", "hello.txt",
"hello.txt + corrupt size", "hello.txt + corrupt size",
"hello world\n", "hello world\n",
......
...@@ -22,13 +22,13 @@ type zlibTest struct { ...@@ -22,13 +22,13 @@ type zlibTest struct {
// http://www.zlib.net/zpipe.c // http://www.zlib.net/zpipe.c
var zlibTests = []zlibTest{ var zlibTests = []zlibTest{
zlibTest{ {
"empty", "empty",
"", "",
[]byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01}, []byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01},
nil, nil,
}, },
zlibTest{ {
"goodbye", "goodbye",
"goodbye, world", "goodbye, world",
[]byte{ []byte{
...@@ -38,25 +38,25 @@ var zlibTests = []zlibTest{ ...@@ -38,25 +38,25 @@ var zlibTests = []zlibTest{
}, },
nil, nil,
}, },
zlibTest{ {
"bad header", "bad header",
"", "",
[]byte{0x78, 0x9f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01}, []byte{0x78, 0x9f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01},
HeaderError, HeaderError,
}, },
zlibTest{ {
"bad checksum", "bad checksum",
"", "",
[]byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0xff}, []byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0xff},
ChecksumError, ChecksumError,
}, },
zlibTest{ {
"not enough data", "not enough data",
"", "",
[]byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00}, []byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00},
io.ErrUnexpectedEOF, io.ErrUnexpectedEOF,
}, },
zlibTest{ {
"excess data is silently ignored", "excess data is silently ignored",
"", "",
[]byte{ []byte{
......
...@@ -130,7 +130,7 @@ type KeyTest struct { ...@@ -130,7 +130,7 @@ type KeyTest struct {
} }
var keyTests = []KeyTest{ var keyTests = []KeyTest{
KeyTest{ {
// A.1. Expansion of a 128-bit Cipher Key // A.1. Expansion of a 128-bit Cipher Key
[]byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
[]uint32{ []uint32{
...@@ -160,7 +160,7 @@ var keyTests = []KeyTest{ ...@@ -160,7 +160,7 @@ var keyTests = []KeyTest{
0x2b7e1516, 0x28aed2a6, 0xabf71588, 0x9cf4f3c, 0x2b7e1516, 0x28aed2a6, 0xabf71588, 0x9cf4f3c,
}, },
}, },
KeyTest{ {
// A.2. Expansion of a 192-bit Cipher Key // A.2. Expansion of a 192-bit Cipher Key
[]byte{ []byte{
0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
...@@ -183,7 +183,7 @@ var keyTests = []KeyTest{ ...@@ -183,7 +183,7 @@ var keyTests = []KeyTest{
}, },
nil, nil,
}, },
KeyTest{ {
// A.3. Expansion of a 256-bit Cipher Key // A.3. Expansion of a 256-bit Cipher Key
[]byte{ []byte{
0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
...@@ -245,19 +245,19 @@ type CryptTest struct { ...@@ -245,19 +245,19 @@ type CryptTest struct {
} }
var encryptTests = []CryptTest{ var encryptTests = []CryptTest{
CryptTest{ {
// Appendix B. // Appendix B.
[]byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
[]byte{0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34}, []byte{0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34},
[]byte{0x39, 0x25, 0x84, 0x1d, 0x02, 0xdc, 0x09, 0xfb, 0xdc, 0x11, 0x85, 0x97, 0x19, 0x6a, 0x0b, 0x32}, []byte{0x39, 0x25, 0x84, 0x1d, 0x02, 0xdc, 0x09, 0xfb, 0xdc, 0x11, 0x85, 0x97, 0x19, 0x6a, 0x0b, 0x32},
}, },
CryptTest{ {
// Appendix C.1. AES-128 // Appendix C.1. AES-128
[]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
[]byte{0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a}, []byte{0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a},
}, },
CryptTest{ {
// Appendix C.2. AES-192 // Appendix C.2. AES-192
[]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
...@@ -265,7 +265,7 @@ var encryptTests = []CryptTest{ ...@@ -265,7 +265,7 @@ var encryptTests = []CryptTest{
[]byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff},
[]byte{0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91}, []byte{0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91},
}, },
CryptTest{ {
// Appendix C.3. AES-256 // Appendix C.3. AES-256
[]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
......
...@@ -81,7 +81,7 @@ var sbox1 = [256]byte{ ...@@ -81,7 +81,7 @@ var sbox1 = [256]byte{
// These can be recomputed by adapting the tests in aes_test.go. // These can be recomputed by adapting the tests in aes_test.go.
var te = [4][256]uint32{ var te = [4][256]uint32{
[256]uint32{ {
0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554,
0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a,
0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b,
...@@ -115,7 +115,7 @@ var te = [4][256]uint32{ ...@@ -115,7 +115,7 @@ var te = [4][256]uint32{
0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8,
0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a,
}, },
[256]uint32{ {
0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5,
0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676,
0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0,
...@@ -149,7 +149,7 @@ var te = [4][256]uint32{ ...@@ -149,7 +149,7 @@ var te = [4][256]uint32{
0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868,
0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616,
}, },
[256]uint32{ {
0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5,
0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76,
0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0,
...@@ -183,7 +183,7 @@ var te = [4][256]uint32{ ...@@ -183,7 +183,7 @@ var te = [4][256]uint32{
0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068,
0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16,
}, },
[256]uint32{ {
0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491,
0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec,
0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb,
...@@ -223,7 +223,7 @@ var te = [4][256]uint32{ ...@@ -223,7 +223,7 @@ var te = [4][256]uint32{
// These can be recomputed by adapting the tests in aes_test.go. // These can be recomputed by adapting the tests in aes_test.go.
var td = [4][256]uint32{ var td = [4][256]uint32{
[256]uint32{ {
0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393,
0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f,
0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6,
...@@ -257,7 +257,7 @@ var td = [4][256]uint32{ ...@@ -257,7 +257,7 @@ var td = [4][256]uint32{
0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541,
0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742,
}, },
[256]uint32{ {
0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303,
0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3,
0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9,
...@@ -291,7 +291,7 @@ var td = [4][256]uint32{ ...@@ -291,7 +291,7 @@ var td = [4][256]uint32{
0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95,
0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857,
}, },
[256]uint32{ {
0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3,
0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562,
0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3,
...@@ -325,7 +325,7 @@ var td = [4][256]uint32{ ...@@ -325,7 +325,7 @@ var td = [4][256]uint32{
0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d,
0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8,
}, },
[256]uint32{ {
0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b,
0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5,
0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b,
......
...@@ -27,7 +27,7 @@ type cbcTest struct { ...@@ -27,7 +27,7 @@ type cbcTest struct {
var cbcAESTests = []cbcTest{ var cbcAESTests = []cbcTest{
// NIST SP 800-38A pp 27-29 // NIST SP 800-38A pp 27-29
cbcTest{ {
"CBC-AES128", "CBC-AES128",
commonKey128, commonKey128,
commonIV, commonIV,
...@@ -39,7 +39,7 @@ var cbcAESTests = []cbcTest{ ...@@ -39,7 +39,7 @@ var cbcAESTests = []cbcTest{
0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7, 0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7,
}, },
}, },
cbcTest{ {
"CBC-AES192", "CBC-AES192",
commonKey192, commonKey192,
commonIV, commonIV,
...@@ -51,7 +51,7 @@ var cbcAESTests = []cbcTest{ ...@@ -51,7 +51,7 @@ var cbcAESTests = []cbcTest{
0x08, 0xb0, 0xe2, 0x79, 0x88, 0x59, 0x88, 0x81, 0xd9, 0x20, 0xa9, 0xe6, 0x4f, 0x56, 0x15, 0xcd, 0x08, 0xb0, 0xe2, 0x79, 0x88, 0x59, 0x88, 0x81, 0xd9, 0x20, 0xa9, 0xe6, 0x4f, 0x56, 0x15, 0xcd,
}, },
}, },
cbcTest{ {
"CBC-AES256", "CBC-AES256",
commonKey256, commonKey256,
commonIV, commonIV,
......
...@@ -27,7 +27,7 @@ type cfbTest struct { ...@@ -27,7 +27,7 @@ type cfbTest struct {
} }
var cfbAESTests = []cfbTest{ var cfbAESTests = []cfbTest{
cfbTest{ {
"CFB1-AES128", "CFB1-AES128",
1, 1,
commonKey128, commonKey128,
...@@ -41,7 +41,7 @@ var cfbAESTests = []cfbTest{ ...@@ -41,7 +41,7 @@ var cfbAESTests = []cfbTest{
1<<7 | 0<<6 | 1<<5 | 1<<4 | 0<<3 | 0<<2 | 1<<1, 1<<7 | 0<<6 | 1<<5 | 1<<4 | 0<<3 | 0<<2 | 1<<1,
}, },
}, },
cfbTest{ {
"CFB1-AES192", "CFB1-AES192",
1, 1,
commonKey192, commonKey192,
...@@ -55,7 +55,7 @@ var cfbAESTests = []cfbTest{ ...@@ -55,7 +55,7 @@ var cfbAESTests = []cfbTest{
0<<7 | 1<<6 | 0<<5 | 1<<4 | 1<<3 | 0<<2 | 0<<1, 0<<7 | 1<<6 | 0<<5 | 1<<4 | 1<<3 | 0<<2 | 0<<1,
}, },
}, },
cfbTest{ {
"CFB1-AES256", "CFB1-AES256",
1, 1,
commonKey256, commonKey256,
...@@ -70,7 +70,7 @@ var cfbAESTests = []cfbTest{ ...@@ -70,7 +70,7 @@ var cfbAESTests = []cfbTest{
}, },
}, },
cfbTest{ {
"CFB8-AES128", "CFB8-AES128",
8, 8,
commonKey128, commonKey128,
...@@ -117,7 +117,7 @@ var cfbAESTests = []cfbTest{ ...@@ -117,7 +117,7 @@ var cfbAESTests = []cfbTest{
}, },
}, },
cfbTest{ {
"CFB8-AES192", "CFB8-AES192",
8, 8,
commonKey192, commonKey192,
...@@ -164,7 +164,7 @@ var cfbAESTests = []cfbTest{ ...@@ -164,7 +164,7 @@ var cfbAESTests = []cfbTest{
}, },
}, },
cfbTest{ {
"CFB8-AES256", "CFB8-AES256",
8, 8,
commonKey256, commonKey256,
...@@ -211,7 +211,7 @@ var cfbAESTests = []cfbTest{ ...@@ -211,7 +211,7 @@ var cfbAESTests = []cfbTest{
}, },
}, },
cfbTest{ {
"CFB128-AES128", "CFB128-AES128",
128, 128,
commonKey128, commonKey128,
...@@ -230,7 +230,7 @@ var cfbAESTests = []cfbTest{ ...@@ -230,7 +230,7 @@ var cfbAESTests = []cfbTest{
}, },
}, },
cfbTest{ {
"CFB128-AES192", "CFB128-AES192",
128, 128,
commonKey192, commonKey192,
...@@ -249,7 +249,7 @@ var cfbAESTests = []cfbTest{ ...@@ -249,7 +249,7 @@ var cfbAESTests = []cfbTest{
}, },
}, },
cfbTest{ {
"CFB128-AES256", "CFB128-AES256",
128, 128,
commonKey256, commonKey256,
......
...@@ -18,17 +18,17 @@ type cmacAESTest struct { ...@@ -18,17 +18,17 @@ type cmacAESTest struct {
} }
var cmacAESTests = []cmacAESTest{ var cmacAESTests = []cmacAESTest{
cmacAESTest{ {
commonKey128, commonKey128,
nil, nil,
[]byte{0xbb, 0x1d, 0x69, 0x29, 0xe9, 0x59, 0x37, 0x28, 0x7f, 0xa3, 0x7d, 0x12, 0x9b, 0x75, 0x67, 0x46}, []byte{0xbb, 0x1d, 0x69, 0x29, 0xe9, 0x59, 0x37, 0x28, 0x7f, 0xa3, 0x7d, 0x12, 0x9b, 0x75, 0x67, 0x46},
}, },
cmacAESTest{ {
commonKey128, commonKey128,
[]byte{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a}, []byte{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
[]byte{0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44, 0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c}, []byte{0x07, 0x0a, 0x16, 0xb4, 0x6b, 0x4d, 0x41, 0x44, 0xf7, 0x9b, 0xdd, 0x9d, 0xd0, 0x4a, 0x28, 0x7c},
}, },
cmacAESTest{ {
commonKey128, commonKey128,
[]byte{ []byte{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
...@@ -37,7 +37,7 @@ var cmacAESTests = []cmacAESTest{ ...@@ -37,7 +37,7 @@ var cmacAESTests = []cmacAESTest{
}, },
[]byte{0xdf, 0xa6, 0x67, 0x47, 0xde, 0x9a, 0xe6, 0x30, 0x30, 0xca, 0x32, 0x61, 0x14, 0x97, 0xc8, 0x27}, []byte{0xdf, 0xa6, 0x67, 0x47, 0xde, 0x9a, 0xe6, 0x30, 0x30, 0xca, 0x32, 0x61, 0x14, 0x97, 0xc8, 0x27},
}, },
cmacAESTest{ {
commonKey128, commonKey128,
[]byte{ []byte{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
...@@ -47,17 +47,17 @@ var cmacAESTests = []cmacAESTest{ ...@@ -47,17 +47,17 @@ var cmacAESTests = []cmacAESTest{
}, },
[]byte{0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92, 0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe}, []byte{0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92, 0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe},
}, },
cmacAESTest{ {
commonKey192, commonKey192,
nil, nil,
[]byte{0xd1, 0x7d, 0xdf, 0x46, 0xad, 0xaa, 0xcd, 0xe5, 0x31, 0xca, 0xc4, 0x83, 0xde, 0x7a, 0x93, 0x67}, []byte{0xd1, 0x7d, 0xdf, 0x46, 0xad, 0xaa, 0xcd, 0xe5, 0x31, 0xca, 0xc4, 0x83, 0xde, 0x7a, 0x93, 0x67},
}, },
cmacAESTest{ {
commonKey192, commonKey192,
[]byte{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a}, []byte{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
[]byte{0x9e, 0x99, 0xa7, 0xbf, 0x31, 0xe7, 0x10, 0x90, 0x06, 0x62, 0xf6, 0x5e, 0x61, 0x7c, 0x51, 0x84}, []byte{0x9e, 0x99, 0xa7, 0xbf, 0x31, 0xe7, 0x10, 0x90, 0x06, 0x62, 0xf6, 0x5e, 0x61, 0x7c, 0x51, 0x84},
}, },
cmacAESTest{ {
commonKey192, commonKey192,
[]byte{ []byte{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
...@@ -66,7 +66,7 @@ var cmacAESTests = []cmacAESTest{ ...@@ -66,7 +66,7 @@ var cmacAESTests = []cmacAESTest{
}, },
[]byte{0x8a, 0x1d, 0xe5, 0xbe, 0x2e, 0xb3, 0x1a, 0xad, 0x08, 0x9a, 0x82, 0xe6, 0xee, 0x90, 0x8b, 0x0e}, []byte{0x8a, 0x1d, 0xe5, 0xbe, 0x2e, 0xb3, 0x1a, 0xad, 0x08, 0x9a, 0x82, 0xe6, 0xee, 0x90, 0x8b, 0x0e},
}, },
cmacAESTest{ {
commonKey192, commonKey192,
[]byte{ []byte{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
...@@ -76,17 +76,17 @@ var cmacAESTests = []cmacAESTest{ ...@@ -76,17 +76,17 @@ var cmacAESTests = []cmacAESTest{
}, },
[]byte{0xa1, 0xd5, 0xdf, 0x0e, 0xed, 0x79, 0x0f, 0x79, 0x4d, 0x77, 0x58, 0x96, 0x59, 0xf3, 0x9a, 0x11}, []byte{0xa1, 0xd5, 0xdf, 0x0e, 0xed, 0x79, 0x0f, 0x79, 0x4d, 0x77, 0x58, 0x96, 0x59, 0xf3, 0x9a, 0x11},
}, },
cmacAESTest{ {
commonKey256, commonKey256,
nil, nil,
[]byte{0x02, 0x89, 0x62, 0xf6, 0x1b, 0x7b, 0xf8, 0x9e, 0xfc, 0x6b, 0x55, 0x1f, 0x46, 0x67, 0xd9, 0x83}, []byte{0x02, 0x89, 0x62, 0xf6, 0x1b, 0x7b, 0xf8, 0x9e, 0xfc, 0x6b, 0x55, 0x1f, 0x46, 0x67, 0xd9, 0x83},
}, },
cmacAESTest{ {
commonKey256, commonKey256,
[]byte{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a}, []byte{0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a},
[]byte{0x28, 0xa7, 0x02, 0x3f, 0x45, 0x2e, 0x8f, 0x82, 0xbd, 0x4b, 0xf2, 0x8d, 0x8c, 0x37, 0xc3, 0x5c}, []byte{0x28, 0xa7, 0x02, 0x3f, 0x45, 0x2e, 0x8f, 0x82, 0xbd, 0x4b, 0xf2, 0x8d, 0x8c, 0x37, 0xc3, 0x5c},
}, },
cmacAESTest{ {
commonKey256, commonKey256,
[]byte{ []byte{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
...@@ -95,7 +95,7 @@ var cmacAESTests = []cmacAESTest{ ...@@ -95,7 +95,7 @@ var cmacAESTests = []cmacAESTest{
}, },
[]byte{0xaa, 0xf3, 0xd8, 0xf1, 0xde, 0x56, 0x40, 0xc2, 0x32, 0xf5, 0xb1, 0x69, 0xb9, 0xc9, 0x11, 0xe6}, []byte{0xaa, 0xf3, 0xd8, 0xf1, 0xde, 0x56, 0x40, 0xc2, 0x32, 0xf5, 0xb1, 0x69, 0xb9, 0xc9, 0x11, 0xe6},
}, },
cmacAESTest{ {
commonKey256, commonKey256,
[]byte{ []byte{
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
......
...@@ -29,7 +29,7 @@ var commonCounter = []byte{0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, ...@@ -29,7 +29,7 @@ var commonCounter = []byte{0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
var ctrAESTests = []ctrTest{ var ctrAESTests = []ctrTest{
// NIST SP 800-38A pp 55-58 // NIST SP 800-38A pp 55-58
ctrTest{ {
"CTR-AES128", "CTR-AES128",
commonKey128, commonKey128,
commonCounter, commonCounter,
...@@ -41,7 +41,7 @@ var ctrAESTests = []ctrTest{ ...@@ -41,7 +41,7 @@ var ctrAESTests = []ctrTest{
0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1, 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee, 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1, 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee,
}, },
}, },
ctrTest{ {
"CTR-AES192", "CTR-AES192",
commonKey192, commonKey192,
commonCounter, commonCounter,
...@@ -53,7 +53,7 @@ var ctrAESTests = []ctrTest{ ...@@ -53,7 +53,7 @@ var ctrAESTests = []ctrTest{
0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58, 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50, 0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58, 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50,
}, },
}, },
ctrTest{ {
"CTR-AES256", "CTR-AES256",
commonKey256, commonKey256,
commonCounter, commonCounter,
......
...@@ -23,70 +23,70 @@ type eaxAESTest struct { ...@@ -23,70 +23,70 @@ type eaxAESTest struct {
} }
var eaxAESTests = []eaxAESTest{ var eaxAESTests = []eaxAESTest{
eaxAESTest{ {
[]byte{}, []byte{},
[]byte{0x23, 0x39, 0x52, 0xDE, 0xE4, 0xD5, 0xED, 0x5F, 0x9B, 0x9C, 0x6D, 0x6F, 0xF8, 0x0F, 0xF4, 0x78}, []byte{0x23, 0x39, 0x52, 0xDE, 0xE4, 0xD5, 0xED, 0x5F, 0x9B, 0x9C, 0x6D, 0x6F, 0xF8, 0x0F, 0xF4, 0x78},
[]byte{0x62, 0xEC, 0x67, 0xF9, 0xC3, 0xA4, 0xA4, 0x07, 0xFC, 0xB2, 0xA8, 0xC4, 0x90, 0x31, 0xA8, 0xB3}, []byte{0x62, 0xEC, 0x67, 0xF9, 0xC3, 0xA4, 0xA4, 0x07, 0xFC, 0xB2, 0xA8, 0xC4, 0x90, 0x31, 0xA8, 0xB3},
[]byte{0x6B, 0xFB, 0x91, 0x4F, 0xD0, 0x7E, 0xAE, 0x6B}, []byte{0x6B, 0xFB, 0x91, 0x4F, 0xD0, 0x7E, 0xAE, 0x6B},
[]byte{0xE0, 0x37, 0x83, 0x0E, 0x83, 0x89, 0xF2, 0x7B, 0x02, 0x5A, 0x2D, 0x65, 0x27, 0xE7, 0x9D, 0x01}, []byte{0xE0, 0x37, 0x83, 0x0E, 0x83, 0x89, 0xF2, 0x7B, 0x02, 0x5A, 0x2D, 0x65, 0x27, 0xE7, 0x9D, 0x01},
}, },
eaxAESTest{ {
[]byte{0xF7, 0xFB}, []byte{0xF7, 0xFB},
[]byte{0x91, 0x94, 0x5D, 0x3F, 0x4D, 0xCB, 0xEE, 0x0B, 0xF4, 0x5E, 0xF5, 0x22, 0x55, 0xF0, 0x95, 0xA4}, []byte{0x91, 0x94, 0x5D, 0x3F, 0x4D, 0xCB, 0xEE, 0x0B, 0xF4, 0x5E, 0xF5, 0x22, 0x55, 0xF0, 0x95, 0xA4},
[]byte{0xBE, 0xCA, 0xF0, 0x43, 0xB0, 0xA2, 0x3D, 0x84, 0x31, 0x94, 0xBA, 0x97, 0x2C, 0x66, 0xDE, 0xBD}, []byte{0xBE, 0xCA, 0xF0, 0x43, 0xB0, 0xA2, 0x3D, 0x84, 0x31, 0x94, 0xBA, 0x97, 0x2C, 0x66, 0xDE, 0xBD},
[]byte{0xFA, 0x3B, 0xFD, 0x48, 0x06, 0xEB, 0x53, 0xFA}, []byte{0xFA, 0x3B, 0xFD, 0x48, 0x06, 0xEB, 0x53, 0xFA},
[]byte{0x19, 0xDD, 0x5C, 0x4C, 0x93, 0x31, 0x04, 0x9D, 0x0B, 0xDA, 0xB0, 0x27, 0x74, 0x08, 0xF6, 0x79, 0x67, 0xE5}, []byte{0x19, 0xDD, 0x5C, 0x4C, 0x93, 0x31, 0x04, 0x9D, 0x0B, 0xDA, 0xB0, 0x27, 0x74, 0x08, 0xF6, 0x79, 0x67, 0xE5},
}, },
eaxAESTest{ {
[]byte{0x1A, 0x47, 0xCB, 0x49, 0x33}, []byte{0x1A, 0x47, 0xCB, 0x49, 0x33},
[]byte{0x01, 0xF7, 0x4A, 0xD6, 0x40, 0x77, 0xF2, 0xE7, 0x04, 0xC0, 0xF6, 0x0A, 0xDA, 0x3D, 0xD5, 0x23}, []byte{0x01, 0xF7, 0x4A, 0xD6, 0x40, 0x77, 0xF2, 0xE7, 0x04, 0xC0, 0xF6, 0x0A, 0xDA, 0x3D, 0xD5, 0x23},
[]byte{0x70, 0xC3, 0xDB, 0x4F, 0x0D, 0x26, 0x36, 0x84, 0x00, 0xA1, 0x0E, 0xD0, 0x5D, 0x2B, 0xFF, 0x5E}, []byte{0x70, 0xC3, 0xDB, 0x4F, 0x0D, 0x26, 0x36, 0x84, 0x00, 0xA1, 0x0E, 0xD0, 0x5D, 0x2B, 0xFF, 0x5E},
[]byte{0x23, 0x4A, 0x34, 0x63, 0xC1, 0x26, 0x4A, 0xC6}, []byte{0x23, 0x4A, 0x34, 0x63, 0xC1, 0x26, 0x4A, 0xC6},
[]byte{0xD8, 0x51, 0xD5, 0xBA, 0xE0, 0x3A, 0x59, 0xF2, 0x38, 0xA2, 0x3E, 0x39, 0x19, 0x9D, 0xC9, 0x26, 0x66, 0x26, 0xC4, 0x0F, 0x80}, []byte{0xD8, 0x51, 0xD5, 0xBA, 0xE0, 0x3A, 0x59, 0xF2, 0x38, 0xA2, 0x3E, 0x39, 0x19, 0x9D, 0xC9, 0x26, 0x66, 0x26, 0xC4, 0x0F, 0x80},
}, },
eaxAESTest{ {
[]byte{0x48, 0x1C, 0x9E, 0x39, 0xB1}, []byte{0x48, 0x1C, 0x9E, 0x39, 0xB1},
[]byte{0xD0, 0x7C, 0xF6, 0xCB, 0xB7, 0xF3, 0x13, 0xBD, 0xDE, 0x66, 0xB7, 0x27, 0xAF, 0xD3, 0xC5, 0xE8}, []byte{0xD0, 0x7C, 0xF6, 0xCB, 0xB7, 0xF3, 0x13, 0xBD, 0xDE, 0x66, 0xB7, 0x27, 0xAF, 0xD3, 0xC5, 0xE8},
[]byte{0x84, 0x08, 0xDF, 0xFF, 0x3C, 0x1A, 0x2B, 0x12, 0x92, 0xDC, 0x19, 0x9E, 0x46, 0xB7, 0xD6, 0x17}, []byte{0x84, 0x08, 0xDF, 0xFF, 0x3C, 0x1A, 0x2B, 0x12, 0x92, 0xDC, 0x19, 0x9E, 0x46, 0xB7, 0xD6, 0x17},
[]byte{0x33, 0xCC, 0xE2, 0xEA, 0xBF, 0xF5, 0xA7, 0x9D}, []byte{0x33, 0xCC, 0xE2, 0xEA, 0xBF, 0xF5, 0xA7, 0x9D},
[]byte{0x63, 0x2A, 0x9D, 0x13, 0x1A, 0xD4, 0xC1, 0x68, 0xA4, 0x22, 0x5D, 0x8E, 0x1F, 0xF7, 0x55, 0x93, 0x99, 0x74, 0xA7, 0xBE, 0xDE}, []byte{0x63, 0x2A, 0x9D, 0x13, 0x1A, 0xD4, 0xC1, 0x68, 0xA4, 0x22, 0x5D, 0x8E, 0x1F, 0xF7, 0x55, 0x93, 0x99, 0x74, 0xA7, 0xBE, 0xDE},
}, },
eaxAESTest{ {
[]byte{0x40, 0xD0, 0xC0, 0x7D, 0xA5, 0xE4}, []byte{0x40, 0xD0, 0xC0, 0x7D, 0xA5, 0xE4},
[]byte{0x35, 0xB6, 0xD0, 0x58, 0x00, 0x05, 0xBB, 0xC1, 0x2B, 0x05, 0x87, 0x12, 0x45, 0x57, 0xD2, 0xC2}, []byte{0x35, 0xB6, 0xD0, 0x58, 0x00, 0x05, 0xBB, 0xC1, 0x2B, 0x05, 0x87, 0x12, 0x45, 0x57, 0xD2, 0xC2},
[]byte{0xFD, 0xB6, 0xB0, 0x66, 0x76, 0xEE, 0xDC, 0x5C, 0x61, 0xD7, 0x42, 0x76, 0xE1, 0xF8, 0xE8, 0x16}, []byte{0xFD, 0xB6, 0xB0, 0x66, 0x76, 0xEE, 0xDC, 0x5C, 0x61, 0xD7, 0x42, 0x76, 0xE1, 0xF8, 0xE8, 0x16},
[]byte{0xAE, 0xB9, 0x6E, 0xAE, 0xBE, 0x29, 0x70, 0xE9}, []byte{0xAE, 0xB9, 0x6E, 0xAE, 0xBE, 0x29, 0x70, 0xE9},
[]byte{0x07, 0x1D, 0xFE, 0x16, 0xC6, 0x75, 0xCB, 0x06, 0x77, 0xE5, 0x36, 0xF7, 0x3A, 0xFE, 0x6A, 0x14, 0xB7, 0x4E, 0xE4, 0x98, 0x44, 0xDD}, []byte{0x07, 0x1D, 0xFE, 0x16, 0xC6, 0x75, 0xCB, 0x06, 0x77, 0xE5, 0x36, 0xF7, 0x3A, 0xFE, 0x6A, 0x14, 0xB7, 0x4E, 0xE4, 0x98, 0x44, 0xDD},
}, },
eaxAESTest{ {
[]byte{0x4D, 0xE3, 0xB3, 0x5C, 0x3F, 0xC0, 0x39, 0x24, 0x5B, 0xD1, 0xFB, 0x7D}, []byte{0x4D, 0xE3, 0xB3, 0x5C, 0x3F, 0xC0, 0x39, 0x24, 0x5B, 0xD1, 0xFB, 0x7D},
[]byte{0xBD, 0x8E, 0x6E, 0x11, 0x47, 0x5E, 0x60, 0xB2, 0x68, 0x78, 0x4C, 0x38, 0xC6, 0x2F, 0xEB, 0x22}, []byte{0xBD, 0x8E, 0x6E, 0x11, 0x47, 0x5E, 0x60, 0xB2, 0x68, 0x78, 0x4C, 0x38, 0xC6, 0x2F, 0xEB, 0x22},
[]byte{0x6E, 0xAC, 0x5C, 0x93, 0x07, 0x2D, 0x8E, 0x85, 0x13, 0xF7, 0x50, 0x93, 0x5E, 0x46, 0xDA, 0x1B}, []byte{0x6E, 0xAC, 0x5C, 0x93, 0x07, 0x2D, 0x8E, 0x85, 0x13, 0xF7, 0x50, 0x93, 0x5E, 0x46, 0xDA, 0x1B},
[]byte{0xD4, 0x48, 0x2D, 0x1C, 0xA7, 0x8D, 0xCE, 0x0F}, []byte{0xD4, 0x48, 0x2D, 0x1C, 0xA7, 0x8D, 0xCE, 0x0F},
[]byte{0x83, 0x5B, 0xB4, 0xF1, 0x5D, 0x74, 0x3E, 0x35, 0x0E, 0x72, 0x84, 0x14, 0xAB, 0xB8, 0x64, 0x4F, 0xD6, 0xCC, 0xB8, 0x69, 0x47, 0xC5, 0xE1, 0x05, 0x90, 0x21, 0x0A, 0x4F}, []byte{0x83, 0x5B, 0xB4, 0xF1, 0x5D, 0x74, 0x3E, 0x35, 0x0E, 0x72, 0x84, 0x14, 0xAB, 0xB8, 0x64, 0x4F, 0xD6, 0xCC, 0xB8, 0x69, 0x47, 0xC5, 0xE1, 0x05, 0x90, 0x21, 0x0A, 0x4F},
}, },
eaxAESTest{ {
[]byte{0x8B, 0x0A, 0x79, 0x30, 0x6C, 0x9C, 0xE7, 0xED, 0x99, 0xDA, 0xE4, 0xF8, 0x7F, 0x8D, 0xD6, 0x16, 0x36}, []byte{0x8B, 0x0A, 0x79, 0x30, 0x6C, 0x9C, 0xE7, 0xED, 0x99, 0xDA, 0xE4, 0xF8, 0x7F, 0x8D, 0xD6, 0x16, 0x36},
[]byte{0x7C, 0x77, 0xD6, 0xE8, 0x13, 0xBE, 0xD5, 0xAC, 0x98, 0xBA, 0xA4, 0x17, 0x47, 0x7A, 0x2E, 0x7D}, []byte{0x7C, 0x77, 0xD6, 0xE8, 0x13, 0xBE, 0xD5, 0xAC, 0x98, 0xBA, 0xA4, 0x17, 0x47, 0x7A, 0x2E, 0x7D},
[]byte{0x1A, 0x8C, 0x98, 0xDC, 0xD7, 0x3D, 0x38, 0x39, 0x3B, 0x2B, 0xF1, 0x56, 0x9D, 0xEE, 0xFC, 0x19}, []byte{0x1A, 0x8C, 0x98, 0xDC, 0xD7, 0x3D, 0x38, 0x39, 0x3B, 0x2B, 0xF1, 0x56, 0x9D, 0xEE, 0xFC, 0x19},
[]byte{0x65, 0xD2, 0x01, 0x79, 0x90, 0xD6, 0x25, 0x28}, []byte{0x65, 0xD2, 0x01, 0x79, 0x90, 0xD6, 0x25, 0x28},
[]byte{0x02, 0x08, 0x3E, 0x39, 0x79, 0xDA, 0x01, 0x48, 0x12, 0xF5, 0x9F, 0x11, 0xD5, 0x26, 0x30, 0xDA, 0x30, 0x13, 0x73, 0x27, 0xD1, 0x06, 0x49, 0xB0, 0xAA, 0x6E, 0x1C, 0x18, 0x1D, 0xB6, 0x17, 0xD7, 0xF2}, []byte{0x02, 0x08, 0x3E, 0x39, 0x79, 0xDA, 0x01, 0x48, 0x12, 0xF5, 0x9F, 0x11, 0xD5, 0x26, 0x30, 0xDA, 0x30, 0x13, 0x73, 0x27, 0xD1, 0x06, 0x49, 0xB0, 0xAA, 0x6E, 0x1C, 0x18, 0x1D, 0xB6, 0x17, 0xD7, 0xF2},
}, },
eaxAESTest{ {
[]byte{0x1B, 0xDA, 0x12, 0x2B, 0xCE, 0x8A, 0x8D, 0xBA, 0xF1, 0x87, 0x7D, 0x96, 0x2B, 0x85, 0x92, 0xDD, 0x2D, 0x56}, []byte{0x1B, 0xDA, 0x12, 0x2B, 0xCE, 0x8A, 0x8D, 0xBA, 0xF1, 0x87, 0x7D, 0x96, 0x2B, 0x85, 0x92, 0xDD, 0x2D, 0x56},
[]byte{0x5F, 0xFF, 0x20, 0xCA, 0xFA, 0xB1, 0x19, 0xCA, 0x2F, 0xC7, 0x35, 0x49, 0xE2, 0x0F, 0x5B, 0x0D}, []byte{0x5F, 0xFF, 0x20, 0xCA, 0xFA, 0xB1, 0x19, 0xCA, 0x2F, 0xC7, 0x35, 0x49, 0xE2, 0x0F, 0x5B, 0x0D},
[]byte{0xDD, 0xE5, 0x9B, 0x97, 0xD7, 0x22, 0x15, 0x6D, 0x4D, 0x9A, 0xFF, 0x2B, 0xC7, 0x55, 0x98, 0x26}, []byte{0xDD, 0xE5, 0x9B, 0x97, 0xD7, 0x22, 0x15, 0x6D, 0x4D, 0x9A, 0xFF, 0x2B, 0xC7, 0x55, 0x98, 0x26},
[]byte{0x54, 0xB9, 0xF0, 0x4E, 0x6A, 0x09, 0x18, 0x9A}, []byte{0x54, 0xB9, 0xF0, 0x4E, 0x6A, 0x09, 0x18, 0x9A},
[]byte{0x2E, 0xC4, 0x7B, 0x2C, 0x49, 0x54, 0xA4, 0x89, 0xAF, 0xC7, 0xBA, 0x48, 0x97, 0xED, 0xCD, 0xAE, 0x8C, 0xC3, 0x3B, 0x60, 0x45, 0x05, 0x99, 0xBD, 0x02, 0xC9, 0x63, 0x82, 0x90, 0x2A, 0xEF, 0x7F, 0x83, 0x2A}, []byte{0x2E, 0xC4, 0x7B, 0x2C, 0x49, 0x54, 0xA4, 0x89, 0xAF, 0xC7, 0xBA, 0x48, 0x97, 0xED, 0xCD, 0xAE, 0x8C, 0xC3, 0x3B, 0x60, 0x45, 0x05, 0x99, 0xBD, 0x02, 0xC9, 0x63, 0x82, 0x90, 0x2A, 0xEF, 0x7F, 0x83, 0x2A},
}, },
eaxAESTest{ {
[]byte{0x6C, 0xF3, 0x67, 0x20, 0x87, 0x2B, 0x85, 0x13, 0xF6, 0xEA, 0xB1, 0xA8, 0xA4, 0x44, 0x38, 0xD5, 0xEF, 0x11}, []byte{0x6C, 0xF3, 0x67, 0x20, 0x87, 0x2B, 0x85, 0x13, 0xF6, 0xEA, 0xB1, 0xA8, 0xA4, 0x44, 0x38, 0xD5, 0xEF, 0x11},
[]byte{0xA4, 0xA4, 0x78, 0x2B, 0xCF, 0xFD, 0x3E, 0xC5, 0xE7, 0xEF, 0x6D, 0x8C, 0x34, 0xA5, 0x61, 0x23}, []byte{0xA4, 0xA4, 0x78, 0x2B, 0xCF, 0xFD, 0x3E, 0xC5, 0xE7, 0xEF, 0x6D, 0x8C, 0x34, 0xA5, 0x61, 0x23},
[]byte{0xB7, 0x81, 0xFC, 0xF2, 0xF7, 0x5F, 0xA5, 0xA8, 0xDE, 0x97, 0xA9, 0xCA, 0x48, 0xE5, 0x22, 0xEC}, []byte{0xB7, 0x81, 0xFC, 0xF2, 0xF7, 0x5F, 0xA5, 0xA8, 0xDE, 0x97, 0xA9, 0xCA, 0x48, 0xE5, 0x22, 0xEC},
[]byte{0x89, 0x9A, 0x17, 0x58, 0x97, 0x56, 0x1D, 0x7E}, []byte{0x89, 0x9A, 0x17, 0x58, 0x97, 0x56, 0x1D, 0x7E},
[]byte{0x0D, 0xE1, 0x8F, 0xD0, 0xFD, 0xD9, 0x1E, 0x7A, 0xF1, 0x9F, 0x1D, 0x8E, 0xE8, 0x73, 0x39, 0x38, 0xB1, 0xE8, 0xE7, 0xF6, 0xD2, 0x23, 0x16, 0x18, 0x10, 0x2F, 0xDB, 0x7F, 0xE5, 0x5F, 0xF1, 0x99, 0x17, 0x00}, []byte{0x0D, 0xE1, 0x8F, 0xD0, 0xFD, 0xD9, 0x1E, 0x7A, 0xF1, 0x9F, 0x1D, 0x8E, 0xE8, 0x73, 0x39, 0x38, 0xB1, 0xE8, 0xE7, 0xF6, 0xD2, 0x23, 0x16, 0x18, 0x10, 0x2F, 0xDB, 0x7F, 0xE5, 0x5F, 0xF1, 0x99, 0x17, 0x00},
}, },
eaxAESTest{ {
[]byte{0xCA, 0x40, 0xD7, 0x44, 0x6E, 0x54, 0x5F, 0xFA, 0xED, 0x3B, 0xD1, 0x2A, 0x74, 0x0A, 0x65, 0x9F, 0xFB, 0xBB, 0x3C, 0xEA, 0xB7}, []byte{0xCA, 0x40, 0xD7, 0x44, 0x6E, 0x54, 0x5F, 0xFA, 0xED, 0x3B, 0xD1, 0x2A, 0x74, 0x0A, 0x65, 0x9F, 0xFB, 0xBB, 0x3C, 0xEA, 0xB7},
[]byte{0x83, 0x95, 0xFC, 0xF1, 0xE9, 0x5B, 0xEB, 0xD6, 0x97, 0xBD, 0x01, 0x0B, 0xC7, 0x66, 0xAA, 0xC3}, []byte{0x83, 0x95, 0xFC, 0xF1, 0xE9, 0x5B, 0xEB, 0xD6, 0x97, 0xBD, 0x01, 0x0B, 0xC7, 0x66, 0xAA, 0xC3},
[]byte{0x22, 0xE7, 0xAD, 0xD9, 0x3C, 0xFC, 0x63, 0x93, 0xC5, 0x7E, 0xC0, 0xB3, 0xC1, 0x7D, 0x6B, 0x44}, []byte{0x22, 0xE7, 0xAD, 0xD9, 0x3C, 0xFC, 0x63, 0x93, 0xC5, 0x7E, 0xC0, 0xB3, 0xC1, 0x7D, 0x6B, 0x44},
......
...@@ -47,7 +47,7 @@ var commonIV = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09 ...@@ -47,7 +47,7 @@ var commonIV = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09
var ecbAESTests = []ecbTest{ var ecbAESTests = []ecbTest{
// FIPS 197, Appendix B, C // FIPS 197, Appendix B, C
ecbTest{ {
"FIPS-197 Appendix B", "FIPS-197 Appendix B",
commonKey128, commonKey128,
[]byte{0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34}, []byte{0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34},
...@@ -55,7 +55,7 @@ var ecbAESTests = []ecbTest{ ...@@ -55,7 +55,7 @@ var ecbAESTests = []ecbTest{
}, },
// NIST SP 800-38A pp 24-27 // NIST SP 800-38A pp 24-27
ecbTest{ {
"ECB-AES128", "ECB-AES128",
commonKey128, commonKey128,
commonInput, commonInput,
...@@ -66,7 +66,7 @@ var ecbAESTests = []ecbTest{ ...@@ -66,7 +66,7 @@ var ecbAESTests = []ecbTest{
0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f, 0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4, 0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f, 0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4,
}, },
}, },
ecbTest{ {
"ECB-AES192", "ECB-AES192",
commonKey192, commonKey192,
commonInput, commonInput,
...@@ -77,7 +77,7 @@ var ecbAESTests = []ecbTest{ ...@@ -77,7 +77,7 @@ var ecbAESTests = []ecbTest{
0x9a, 0x4b, 0x41, 0xba, 0x73, 0x8d, 0x6c, 0x72, 0xfb, 0x16, 0x69, 0x16, 0x03, 0xc1, 0x8e, 0x0e, 0x9a, 0x4b, 0x41, 0xba, 0x73, 0x8d, 0x6c, 0x72, 0xfb, 0x16, 0x69, 0x16, 0x03, 0xc1, 0x8e, 0x0e,
}, },
}, },
ecbTest{ {
"ECB-AES256", "ECB-AES256",
commonKey256, commonKey256,
commonInput, commonInput,
......
...@@ -27,7 +27,7 @@ type ofbTest struct { ...@@ -27,7 +27,7 @@ type ofbTest struct {
var ofbAESTests = []ofbTest{ var ofbAESTests = []ofbTest{
// NIST SP 800-38A pp 52-55 // NIST SP 800-38A pp 52-55
ofbTest{ {
"OFB-AES128", "OFB-AES128",
commonKey128, commonKey128,
commonIV, commonIV,
...@@ -39,7 +39,7 @@ var ofbAESTests = []ofbTest{ ...@@ -39,7 +39,7 @@ var ofbAESTests = []ofbTest{
0x30, 0x4c, 0x65, 0x28, 0xf6, 0x59, 0xc7, 0x78, 0x66, 0xa5, 0x10, 0xd9, 0xc1, 0xd6, 0xae, 0x5e, 0x30, 0x4c, 0x65, 0x28, 0xf6, 0x59, 0xc7, 0x78, 0x66, 0xa5, 0x10, 0xd9, 0xc1, 0xd6, 0xae, 0x5e,
}, },
}, },
ofbTest{ {
"OFB-AES192", "OFB-AES192",
commonKey192, commonKey192,
commonIV, commonIV,
...@@ -51,7 +51,7 @@ var ofbAESTests = []ofbTest{ ...@@ -51,7 +51,7 @@ var ofbAESTests = []ofbTest{
0x6d, 0x9f, 0x20, 0x08, 0x57, 0xca, 0x6c, 0x3e, 0x9c, 0xac, 0x52, 0x4b, 0xd9, 0xac, 0xc9, 0x2a, 0x6d, 0x9f, 0x20, 0x08, 0x57, 0xca, 0x6c, 0x3e, 0x9c, 0xac, 0x52, 0x4b, 0xd9, 0xac, 0xc9, 0x2a,
}, },
}, },
ofbTest{ {
"OFB-AES256", "OFB-AES256",
commonKey256, commonKey256,
commonIV, commonIV,
......
...@@ -16,140 +16,140 @@ type CryptTest struct { ...@@ -16,140 +16,140 @@ type CryptTest struct {
// Test vector values are from http://www.schneier.com/code/vectors.txt. // Test vector values are from http://www.schneier.com/code/vectors.txt.
var encryptTests = []CryptTest{ var encryptTests = []CryptTest{
CryptTest{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}}, []byte{0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}},
CryptTest{ {
[]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
[]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
[]byte{0x51, 0x86, 0x6F, 0xD5, 0xB8, 0x5E, 0xCB, 0x8A}}, []byte{0x51, 0x86, 0x6F, 0xD5, 0xB8, 0x5E, 0xCB, 0x8A}},
CryptTest{ {
[]byte{0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, []byte{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
[]byte{0x7D, 0x85, 0x6F, 0x9A, 0x61, 0x30, 0x63, 0xF2}}, []byte{0x7D, 0x85, 0x6F, 0x9A, 0x61, 0x30, 0x63, 0xF2}},
CryptTest{ {
[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
[]byte{0x24, 0x66, 0xDD, 0x87, 0x8B, 0x96, 0x3C, 0x9D}}, []byte{0x24, 0x66, 0xDD, 0x87, 0x8B, 0x96, 0x3C, 0x9D}},
CryptTest{ {
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
[]byte{0x61, 0xF9, 0xC3, 0x80, 0x22, 0x81, 0xB0, 0x96}}, []byte{0x61, 0xF9, 0xC3, 0x80, 0x22, 0x81, 0xB0, 0x96}},
CryptTest{ {
[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
[]byte{0x7D, 0x0C, 0xC6, 0x30, 0xAF, 0xDA, 0x1E, 0xC7}}, []byte{0x7D, 0x0C, 0xC6, 0x30, 0xAF, 0xDA, 0x1E, 0xC7}},
CryptTest{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}}, []byte{0x4E, 0xF9, 0x97, 0x45, 0x61, 0x98, 0xDD, 0x78}},
CryptTest{ {
[]byte{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10}, []byte{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
[]byte{0x0A, 0xCE, 0xAB, 0x0F, 0xC6, 0xA0, 0xA2, 0x8D}}, []byte{0x0A, 0xCE, 0xAB, 0x0F, 0xC6, 0xA0, 0xA2, 0x8D}},
CryptTest{ {
[]byte{0x7C, 0xA1, 0x10, 0x45, 0x4A, 0x1A, 0x6E, 0x57}, []byte{0x7C, 0xA1, 0x10, 0x45, 0x4A, 0x1A, 0x6E, 0x57},
[]byte{0x01, 0xA1, 0xD6, 0xD0, 0x39, 0x77, 0x67, 0x42}, []byte{0x01, 0xA1, 0xD6, 0xD0, 0x39, 0x77, 0x67, 0x42},
[]byte{0x59, 0xC6, 0x82, 0x45, 0xEB, 0x05, 0x28, 0x2B}}, []byte{0x59, 0xC6, 0x82, 0x45, 0xEB, 0x05, 0x28, 0x2B}},
CryptTest{ {
[]byte{0x01, 0x31, 0xD9, 0x61, 0x9D, 0xC1, 0x37, 0x6E}, []byte{0x01, 0x31, 0xD9, 0x61, 0x9D, 0xC1, 0x37, 0x6E},
[]byte{0x5C, 0xD5, 0x4C, 0xA8, 0x3D, 0xEF, 0x57, 0xDA}, []byte{0x5C, 0xD5, 0x4C, 0xA8, 0x3D, 0xEF, 0x57, 0xDA},
[]byte{0xB1, 0xB8, 0xCC, 0x0B, 0x25, 0x0F, 0x09, 0xA0}}, []byte{0xB1, 0xB8, 0xCC, 0x0B, 0x25, 0x0F, 0x09, 0xA0}},
CryptTest{ {
[]byte{0x07, 0xA1, 0x13, 0x3E, 0x4A, 0x0B, 0x26, 0x86}, []byte{0x07, 0xA1, 0x13, 0x3E, 0x4A, 0x0B, 0x26, 0x86},
[]byte{0x02, 0x48, 0xD4, 0x38, 0x06, 0xF6, 0x71, 0x72}, []byte{0x02, 0x48, 0xD4, 0x38, 0x06, 0xF6, 0x71, 0x72},
[]byte{0x17, 0x30, 0xE5, 0x77, 0x8B, 0xEA, 0x1D, 0xA4}}, []byte{0x17, 0x30, 0xE5, 0x77, 0x8B, 0xEA, 0x1D, 0xA4}},
CryptTest{ {
[]byte{0x38, 0x49, 0x67, 0x4C, 0x26, 0x02, 0x31, 0x9E}, []byte{0x38, 0x49, 0x67, 0x4C, 0x26, 0x02, 0x31, 0x9E},
[]byte{0x51, 0x45, 0x4B, 0x58, 0x2D, 0xDF, 0x44, 0x0A}, []byte{0x51, 0x45, 0x4B, 0x58, 0x2D, 0xDF, 0x44, 0x0A},
[]byte{0xA2, 0x5E, 0x78, 0x56, 0xCF, 0x26, 0x51, 0xEB}}, []byte{0xA2, 0x5E, 0x78, 0x56, 0xCF, 0x26, 0x51, 0xEB}},
CryptTest{ {
[]byte{0x04, 0xB9, 0x15, 0xBA, 0x43, 0xFE, 0xB5, 0xB6}, []byte{0x04, 0xB9, 0x15, 0xBA, 0x43, 0xFE, 0xB5, 0xB6},
[]byte{0x42, 0xFD, 0x44, 0x30, 0x59, 0x57, 0x7F, 0xA2}, []byte{0x42, 0xFD, 0x44, 0x30, 0x59, 0x57, 0x7F, 0xA2},
[]byte{0x35, 0x38, 0x82, 0xB1, 0x09, 0xCE, 0x8F, 0x1A}}, []byte{0x35, 0x38, 0x82, 0xB1, 0x09, 0xCE, 0x8F, 0x1A}},
CryptTest{ {
[]byte{0x01, 0x13, 0xB9, 0x70, 0xFD, 0x34, 0xF2, 0xCE}, []byte{0x01, 0x13, 0xB9, 0x70, 0xFD, 0x34, 0xF2, 0xCE},
[]byte{0x05, 0x9B, 0x5E, 0x08, 0x51, 0xCF, 0x14, 0x3A}, []byte{0x05, 0x9B, 0x5E, 0x08, 0x51, 0xCF, 0x14, 0x3A},
[]byte{0x48, 0xF4, 0xD0, 0x88, 0x4C, 0x37, 0x99, 0x18}}, []byte{0x48, 0xF4, 0xD0, 0x88, 0x4C, 0x37, 0x99, 0x18}},
CryptTest{ {
[]byte{0x01, 0x70, 0xF1, 0x75, 0x46, 0x8F, 0xB5, 0xE6}, []byte{0x01, 0x70, 0xF1, 0x75, 0x46, 0x8F, 0xB5, 0xE6},
[]byte{0x07, 0x56, 0xD8, 0xE0, 0x77, 0x47, 0x61, 0xD2}, []byte{0x07, 0x56, 0xD8, 0xE0, 0x77, 0x47, 0x61, 0xD2},
[]byte{0x43, 0x21, 0x93, 0xB7, 0x89, 0x51, 0xFC, 0x98}}, []byte{0x43, 0x21, 0x93, 0xB7, 0x89, 0x51, 0xFC, 0x98}},
CryptTest{ {
[]byte{0x43, 0x29, 0x7F, 0xAD, 0x38, 0xE3, 0x73, 0xFE}, []byte{0x43, 0x29, 0x7F, 0xAD, 0x38, 0xE3, 0x73, 0xFE},
[]byte{0x76, 0x25, 0x14, 0xB8, 0x29, 0xBF, 0x48, 0x6A}, []byte{0x76, 0x25, 0x14, 0xB8, 0x29, 0xBF, 0x48, 0x6A},
[]byte{0x13, 0xF0, 0x41, 0x54, 0xD6, 0x9D, 0x1A, 0xE5}}, []byte{0x13, 0xF0, 0x41, 0x54, 0xD6, 0x9D, 0x1A, 0xE5}},
CryptTest{ {
[]byte{0x07, 0xA7, 0x13, 0x70, 0x45, 0xDA, 0x2A, 0x16}, []byte{0x07, 0xA7, 0x13, 0x70, 0x45, 0xDA, 0x2A, 0x16},
[]byte{0x3B, 0xDD, 0x11, 0x90, 0x49, 0x37, 0x28, 0x02}, []byte{0x3B, 0xDD, 0x11, 0x90, 0x49, 0x37, 0x28, 0x02},
[]byte{0x2E, 0xED, 0xDA, 0x93, 0xFF, 0xD3, 0x9C, 0x79}}, []byte{0x2E, 0xED, 0xDA, 0x93, 0xFF, 0xD3, 0x9C, 0x79}},
CryptTest{ {
[]byte{0x04, 0x68, 0x91, 0x04, 0xC2, 0xFD, 0x3B, 0x2F}, []byte{0x04, 0x68, 0x91, 0x04, 0xC2, 0xFD, 0x3B, 0x2F},
[]byte{0x26, 0x95, 0x5F, 0x68, 0x35, 0xAF, 0x60, 0x9A}, []byte{0x26, 0x95, 0x5F, 0x68, 0x35, 0xAF, 0x60, 0x9A},
[]byte{0xD8, 0x87, 0xE0, 0x39, 0x3C, 0x2D, 0xA6, 0xE3}}, []byte{0xD8, 0x87, 0xE0, 0x39, 0x3C, 0x2D, 0xA6, 0xE3}},
CryptTest{ {
[]byte{0x37, 0xD0, 0x6B, 0xB5, 0x16, 0xCB, 0x75, 0x46}, []byte{0x37, 0xD0, 0x6B, 0xB5, 0x16, 0xCB, 0x75, 0x46},
[]byte{0x16, 0x4D, 0x5E, 0x40, 0x4F, 0x27, 0x52, 0x32}, []byte{0x16, 0x4D, 0x5E, 0x40, 0x4F, 0x27, 0x52, 0x32},
[]byte{0x5F, 0x99, 0xD0, 0x4F, 0x5B, 0x16, 0x39, 0x69}}, []byte{0x5F, 0x99, 0xD0, 0x4F, 0x5B, 0x16, 0x39, 0x69}},
CryptTest{ {
[]byte{0x1F, 0x08, 0x26, 0x0D, 0x1A, 0xC2, 0x46, 0x5E}, []byte{0x1F, 0x08, 0x26, 0x0D, 0x1A, 0xC2, 0x46, 0x5E},
[]byte{0x6B, 0x05, 0x6E, 0x18, 0x75, 0x9F, 0x5C, 0xCA}, []byte{0x6B, 0x05, 0x6E, 0x18, 0x75, 0x9F, 0x5C, 0xCA},
[]byte{0x4A, 0x05, 0x7A, 0x3B, 0x24, 0xD3, 0x97, 0x7B}}, []byte{0x4A, 0x05, 0x7A, 0x3B, 0x24, 0xD3, 0x97, 0x7B}},
CryptTest{ {
[]byte{0x58, 0x40, 0x23, 0x64, 0x1A, 0xBA, 0x61, 0x76}, []byte{0x58, 0x40, 0x23, 0x64, 0x1A, 0xBA, 0x61, 0x76},
[]byte{0x00, 0x4B, 0xD6, 0xEF, 0x09, 0x17, 0x60, 0x62}, []byte{0x00, 0x4B, 0xD6, 0xEF, 0x09, 0x17, 0x60, 0x62},
[]byte{0x45, 0x20, 0x31, 0xC1, 0xE4, 0xFA, 0xDA, 0x8E}}, []byte{0x45, 0x20, 0x31, 0xC1, 0xE4, 0xFA, 0xDA, 0x8E}},
CryptTest{ {
[]byte{0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xB0, 0x07}, []byte{0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xB0, 0x07},
[]byte{0x48, 0x0D, 0x39, 0x00, 0x6E, 0xE7, 0x62, 0xF2}, []byte{0x48, 0x0D, 0x39, 0x00, 0x6E, 0xE7, 0x62, 0xF2},
[]byte{0x75, 0x55, 0xAE, 0x39, 0xF5, 0x9B, 0x87, 0xBD}}, []byte{0x75, 0x55, 0xAE, 0x39, 0xF5, 0x9B, 0x87, 0xBD}},
CryptTest{ {
[]byte{0x49, 0x79, 0x3E, 0xBC, 0x79, 0xB3, 0x25, 0x8F}, []byte{0x49, 0x79, 0x3E, 0xBC, 0x79, 0xB3, 0x25, 0x8F},
[]byte{0x43, 0x75, 0x40, 0xC8, 0x69, 0x8F, 0x3C, 0xFA}, []byte{0x43, 0x75, 0x40, 0xC8, 0x69, 0x8F, 0x3C, 0xFA},
[]byte{0x53, 0xC5, 0x5F, 0x9C, 0xB4, 0x9F, 0xC0, 0x19}}, []byte{0x53, 0xC5, 0x5F, 0x9C, 0xB4, 0x9F, 0xC0, 0x19}},
CryptTest{ {
[]byte{0x4F, 0xB0, 0x5E, 0x15, 0x15, 0xAB, 0x73, 0xA7}, []byte{0x4F, 0xB0, 0x5E, 0x15, 0x15, 0xAB, 0x73, 0xA7},
[]byte{0x07, 0x2D, 0x43, 0xA0, 0x77, 0x07, 0x52, 0x92}, []byte{0x07, 0x2D, 0x43, 0xA0, 0x77, 0x07, 0x52, 0x92},
[]byte{0x7A, 0x8E, 0x7B, 0xFA, 0x93, 0x7E, 0x89, 0xA3}}, []byte{0x7A, 0x8E, 0x7B, 0xFA, 0x93, 0x7E, 0x89, 0xA3}},
CryptTest{ {
[]byte{0x49, 0xE9, 0x5D, 0x6D, 0x4C, 0xA2, 0x29, 0xBF}, []byte{0x49, 0xE9, 0x5D, 0x6D, 0x4C, 0xA2, 0x29, 0xBF},
[]byte{0x02, 0xFE, 0x55, 0x77, 0x81, 0x17, 0xF1, 0x2A}, []byte{0x02, 0xFE, 0x55, 0x77, 0x81, 0x17, 0xF1, 0x2A},
[]byte{0xCF, 0x9C, 0x5D, 0x7A, 0x49, 0x86, 0xAD, 0xB5}}, []byte{0xCF, 0x9C, 0x5D, 0x7A, 0x49, 0x86, 0xAD, 0xB5}},
CryptTest{ {
[]byte{0x01, 0x83, 0x10, 0xDC, 0x40, 0x9B, 0x26, 0xD6}, []byte{0x01, 0x83, 0x10, 0xDC, 0x40, 0x9B, 0x26, 0xD6},
[]byte{0x1D, 0x9D, 0x5C, 0x50, 0x18, 0xF7, 0x28, 0xC2}, []byte{0x1D, 0x9D, 0x5C, 0x50, 0x18, 0xF7, 0x28, 0xC2},
[]byte{0xD1, 0xAB, 0xB2, 0x90, 0x65, 0x8B, 0xC7, 0x78}}, []byte{0xD1, 0xAB, 0xB2, 0x90, 0x65, 0x8B, 0xC7, 0x78}},
CryptTest{ {
[]byte{0x1C, 0x58, 0x7F, 0x1C, 0x13, 0x92, 0x4F, 0xEF}, []byte{0x1C, 0x58, 0x7F, 0x1C, 0x13, 0x92, 0x4F, 0xEF},
[]byte{0x30, 0x55, 0x32, 0x28, 0x6D, 0x6F, 0x29, 0x5A}, []byte{0x30, 0x55, 0x32, 0x28, 0x6D, 0x6F, 0x29, 0x5A},
[]byte{0x55, 0xCB, 0x37, 0x74, 0xD1, 0x3E, 0xF2, 0x01}}, []byte{0x55, 0xCB, 0x37, 0x74, 0xD1, 0x3E, 0xF2, 0x01}},
CryptTest{ {
[]byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, []byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01},
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
[]byte{0xFA, 0x34, 0xEC, 0x48, 0x47, 0xB2, 0x68, 0xB2}}, []byte{0xFA, 0x34, 0xEC, 0x48, 0x47, 0xB2, 0x68, 0xB2}},
CryptTest{ {
[]byte{0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E}, []byte{0x1F, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x0E},
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
[]byte{0xA7, 0x90, 0x79, 0x51, 0x08, 0xEA, 0x3C, 0xAE}}, []byte{0xA7, 0x90, 0x79, 0x51, 0x08, 0xEA, 0x3C, 0xAE}},
CryptTest{ {
[]byte{0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE}, []byte{0xE0, 0xFE, 0xE0, 0xFE, 0xF1, 0xFE, 0xF1, 0xFE},
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
[]byte{0xC3, 0x9E, 0x07, 0x2D, 0x9F, 0xAC, 0x63, 0x1D}}, []byte{0xC3, 0x9E, 0x07, 0x2D, 0x9F, 0xAC, 0x63, 0x1D}},
CryptTest{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
[]byte{0x01, 0x49, 0x33, 0xE0, 0xCD, 0xAF, 0xF6, 0xE4}}, []byte{0x01, 0x49, 0x33, 0xE0, 0xCD, 0xAF, 0xF6, 0xE4}},
CryptTest{ {
[]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0xF2, 0x1E, 0x9A, 0x77, 0xB7, 0x1C, 0x49, 0xBC}}, []byte{0xF2, 0x1E, 0x9A, 0x77, 0xB7, 0x1C, 0x49, 0xBC}},
CryptTest{ {
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF}, []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF},
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x24, 0x59, 0x46, 0x88, 0x57, 0x54, 0x36, 0x9A}}, []byte{0x24, 0x59, 0x46, 0x88, 0x57, 0x54, 0x36, 0x9A}},
CryptTest{ {
[]byte{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10}, []byte{0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10},
[]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
[]byte{0x6B, 0x5C, 0x5A, 0x9C, 0x5D, 0x9E, 0x0A, 0x5A}}, []byte{0x6B, 0x5C, 0x5A, 0x9C, 0x5D, 0x9E, 0x0A, 0x5A}},
......
...@@ -20,7 +20,7 @@ type hmacTest struct { ...@@ -20,7 +20,7 @@ type hmacTest struct {
// Tests from US FIPS 198 // Tests from US FIPS 198
// http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf // http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf
var hmacTests = []hmacTest{ var hmacTests = []hmacTest{
hmacTest{ {
NewSHA1, NewSHA1,
[]byte{ []byte{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
...@@ -35,7 +35,7 @@ var hmacTests = []hmacTest{ ...@@ -35,7 +35,7 @@ var hmacTests = []hmacTest{
[]byte("Sample #1"), []byte("Sample #1"),
"4f4ca3d5d68ba7cc0a1208c9c61e9c5da0403c0a", "4f4ca3d5d68ba7cc0a1208c9c61e9c5da0403c0a",
}, },
hmacTest{ {
NewSHA1, NewSHA1,
[]byte{ []byte{
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
...@@ -45,7 +45,7 @@ var hmacTests = []hmacTest{ ...@@ -45,7 +45,7 @@ var hmacTests = []hmacTest{
[]byte("Sample #2"), []byte("Sample #2"),
"0922d3405faa3d194f82a45830737d5cc6c75d24", "0922d3405faa3d194f82a45830737d5cc6c75d24",
}, },
hmacTest{ {
NewSHA1, NewSHA1,
[]byte{ []byte{
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
...@@ -67,7 +67,7 @@ var hmacTests = []hmacTest{ ...@@ -67,7 +67,7 @@ var hmacTests = []hmacTest{
}, },
// Test from Plan 9. // Test from Plan 9.
hmacTest{ {
NewMD5, NewMD5,
[]byte("Jefe"), []byte("Jefe"),
[]byte("what do ya want for nothing?"), []byte("what do ya want for nothing?"),
......
...@@ -16,37 +16,37 @@ type md4Test struct { ...@@ -16,37 +16,37 @@ type md4Test struct {
} }
var golden = []md4Test{ var golden = []md4Test{
md4Test{"31d6cfe0d16ae931b73c59d7e0c089c0", ""}, {"31d6cfe0d16ae931b73c59d7e0c089c0", ""},
md4Test{"bde52cb31de33e46245e05fbdbd6fb24", "a"}, {"bde52cb31de33e46245e05fbdbd6fb24", "a"},
md4Test{"ec388dd78999dfc7cf4632465693b6bf", "ab"}, {"ec388dd78999dfc7cf4632465693b6bf", "ab"},
md4Test{"a448017aaf21d8525fc10ae87aa6729d", "abc"}, {"a448017aaf21d8525fc10ae87aa6729d", "abc"},
md4Test{"41decd8f579255c5200f86a4bb3ba740", "abcd"}, {"41decd8f579255c5200f86a4bb3ba740", "abcd"},
md4Test{"9803f4a34e8eb14f96adba49064a0c41", "abcde"}, {"9803f4a34e8eb14f96adba49064a0c41", "abcde"},
md4Test{"804e7f1c2586e50b49ac65db5b645131", "abcdef"}, {"804e7f1c2586e50b49ac65db5b645131", "abcdef"},
md4Test{"752f4adfe53d1da0241b5bc216d098fc", "abcdefg"}, {"752f4adfe53d1da0241b5bc216d098fc", "abcdefg"},
md4Test{"ad9daf8d49d81988590a6f0e745d15dd", "abcdefgh"}, {"ad9daf8d49d81988590a6f0e745d15dd", "abcdefgh"},
md4Test{"1e4e28b05464316b56402b3815ed2dfd", "abcdefghi"}, {"1e4e28b05464316b56402b3815ed2dfd", "abcdefghi"},
md4Test{"dc959c6f5d6f9e04e4380777cc964b3d", "abcdefghij"}, {"dc959c6f5d6f9e04e4380777cc964b3d", "abcdefghij"},
md4Test{"1b5701e265778898ef7de5623bbe7cc0", "Discard medicine more than two years old."}, {"1b5701e265778898ef7de5623bbe7cc0", "Discard medicine more than two years old."},
md4Test{"d7f087e090fe7ad4a01cb59dacc9a572", "He who has a shady past knows that nice guys finish last."}, {"d7f087e090fe7ad4a01cb59dacc9a572", "He who has a shady past knows that nice guys finish last."},
md4Test{"a6f8fd6df617c72837592fc3570595c9", "I wouldn't marry him with a ten foot pole."}, {"a6f8fd6df617c72837592fc3570595c9", "I wouldn't marry him with a ten foot pole."},
md4Test{"c92a84a9526da8abc240c05d6b1a1ce0", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"}, {"c92a84a9526da8abc240c05d6b1a1ce0", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"},
md4Test{"f6013160c4dcb00847069fee3bb09803", "The days of the digital watch are numbered. -Tom Stoppard"}, {"f6013160c4dcb00847069fee3bb09803", "The days of the digital watch are numbered. -Tom Stoppard"},
md4Test{"2c3bb64f50b9107ed57640fe94bec09f", "Nepal premier won't resign."}, {"2c3bb64f50b9107ed57640fe94bec09f", "Nepal premier won't resign."},
md4Test{"45b7d8a32c7806f2f7f897332774d6e4", "For every action there is an equal and opposite government program."}, {"45b7d8a32c7806f2f7f897332774d6e4", "For every action there is an equal and opposite government program."},
md4Test{"b5b4f9026b175c62d7654bdc3a1cd438", "His money is twice tainted: 'taint yours and 'taint mine."}, {"b5b4f9026b175c62d7654bdc3a1cd438", "His money is twice tainted: 'taint yours and 'taint mine."},
md4Test{"caf44e80f2c20ce19b5ba1cab766e7bd", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"}, {"caf44e80f2c20ce19b5ba1cab766e7bd", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"},
md4Test{"191fae6707f496aa54a6bce9f2ecf74d", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"}, {"191fae6707f496aa54a6bce9f2ecf74d", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"},
md4Test{"9ddc753e7a4ccee6081cd1b45b23a834", "size: a.out: bad magic"}, {"9ddc753e7a4ccee6081cd1b45b23a834", "size: a.out: bad magic"},
md4Test{"8d050f55b1cadb9323474564be08a521", "The major problem is with sendmail. -Mark Horton"}, {"8d050f55b1cadb9323474564be08a521", "The major problem is with sendmail. -Mark Horton"},
md4Test{"ad6e2587f74c3e3cc19146f6127fa2e3", "Give me a rock, paper and scissors and I will move the world. CCFestoon"}, {"ad6e2587f74c3e3cc19146f6127fa2e3", "Give me a rock, paper and scissors and I will move the world. CCFestoon"},
md4Test{"1d616d60a5fabe85589c3f1566ca7fca", "If the enemy is within range, then so are you."}, {"1d616d60a5fabe85589c3f1566ca7fca", "If the enemy is within range, then so are you."},
md4Test{"aec3326a4f496a2ced65a1963f84577f", "It's well we cannot hear the screams/That we create in others' dreams."}, {"aec3326a4f496a2ced65a1963f84577f", "It's well we cannot hear the screams/That we create in others' dreams."},
md4Test{"77b4fd762d6b9245e61c50bf6ebf118b", "You remind me of a TV show, but that's all right: I watch it anyway."}, {"77b4fd762d6b9245e61c50bf6ebf118b", "You remind me of a TV show, but that's all right: I watch it anyway."},
md4Test{"e8f48c726bae5e516f6ddb1a4fe62438", "C is as portable as Stonehedge!!"}, {"e8f48c726bae5e516f6ddb1a4fe62438", "C is as portable as Stonehedge!!"},
md4Test{"a3a84366e7219e887423b01f9be7166e", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"}, {"a3a84366e7219e887423b01f9be7166e", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"},
md4Test{"a6b7aa35157e984ef5d9b7f32e5fbb52", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"}, {"a6b7aa35157e984ef5d9b7f32e5fbb52", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"},
md4Test{"75661f0545955f8f9abeeb17845f3fd6", "How can you write a big system without C++? -Paul Glick"}, {"75661f0545955f8f9abeeb17845f3fd6", "How can you write a big system without C++? -Paul Glick"},
} }
func TestGolden(t *testing.T) { func TestGolden(t *testing.T) {
......
...@@ -16,37 +16,37 @@ type md5Test struct { ...@@ -16,37 +16,37 @@ type md5Test struct {
} }
var golden = []md5Test{ var golden = []md5Test{
md5Test{"d41d8cd98f00b204e9800998ecf8427e", ""}, {"d41d8cd98f00b204e9800998ecf8427e", ""},
md5Test{"0cc175b9c0f1b6a831c399e269772661", "a"}, {"0cc175b9c0f1b6a831c399e269772661", "a"},
md5Test{"187ef4436122d1cc2f40dc2b92f0eba0", "ab"}, {"187ef4436122d1cc2f40dc2b92f0eba0", "ab"},
md5Test{"900150983cd24fb0d6963f7d28e17f72", "abc"}, {"900150983cd24fb0d6963f7d28e17f72", "abc"},
md5Test{"e2fc714c4727ee9395f324cd2e7f331f", "abcd"}, {"e2fc714c4727ee9395f324cd2e7f331f", "abcd"},
md5Test{"ab56b4d92b40713acc5af89985d4b786", "abcde"}, {"ab56b4d92b40713acc5af89985d4b786", "abcde"},
md5Test{"e80b5017098950fc58aad83c8c14978e", "abcdef"}, {"e80b5017098950fc58aad83c8c14978e", "abcdef"},
md5Test{"7ac66c0f148de9519b8bd264312c4d64", "abcdefg"}, {"7ac66c0f148de9519b8bd264312c4d64", "abcdefg"},
md5Test{"e8dc4081b13434b45189a720b77b6818", "abcdefgh"}, {"e8dc4081b13434b45189a720b77b6818", "abcdefgh"},
md5Test{"8aa99b1f439ff71293e95357bac6fd94", "abcdefghi"}, {"8aa99b1f439ff71293e95357bac6fd94", "abcdefghi"},
md5Test{"a925576942e94b2ef57a066101b48876", "abcdefghij"}, {"a925576942e94b2ef57a066101b48876", "abcdefghij"},
md5Test{"d747fc1719c7eacb84058196cfe56d57", "Discard medicine more than two years old."}, {"d747fc1719c7eacb84058196cfe56d57", "Discard medicine more than two years old."},
md5Test{"bff2dcb37ef3a44ba43ab144768ca837", "He who has a shady past knows that nice guys finish last."}, {"bff2dcb37ef3a44ba43ab144768ca837", "He who has a shady past knows that nice guys finish last."},
md5Test{"0441015ecb54a7342d017ed1bcfdbea5", "I wouldn't marry him with a ten foot pole."}, {"0441015ecb54a7342d017ed1bcfdbea5", "I wouldn't marry him with a ten foot pole."},
md5Test{"9e3cac8e9e9757a60c3ea391130d3689", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"}, {"9e3cac8e9e9757a60c3ea391130d3689", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"},
md5Test{"a0f04459b031f916a59a35cc482dc039", "The days of the digital watch are numbered. -Tom Stoppard"}, {"a0f04459b031f916a59a35cc482dc039", "The days of the digital watch are numbered. -Tom Stoppard"},
md5Test{"e7a48e0fe884faf31475d2a04b1362cc", "Nepal premier won't resign."}, {"e7a48e0fe884faf31475d2a04b1362cc", "Nepal premier won't resign."},
md5Test{"637d2fe925c07c113800509964fb0e06", "For every action there is an equal and opposite government program."}, {"637d2fe925c07c113800509964fb0e06", "For every action there is an equal and opposite government program."},
md5Test{"834a8d18d5c6562119cf4c7f5086cb71", "His money is twice tainted: 'taint yours and 'taint mine."}, {"834a8d18d5c6562119cf4c7f5086cb71", "His money is twice tainted: 'taint yours and 'taint mine."},
md5Test{"de3a4d2fd6c73ec2db2abad23b444281", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"}, {"de3a4d2fd6c73ec2db2abad23b444281", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"},
md5Test{"acf203f997e2cf74ea3aff86985aefaf", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"}, {"acf203f997e2cf74ea3aff86985aefaf", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"},
md5Test{"e1c1384cb4d2221dfdd7c795a4222c9a", "size: a.out: bad magic"}, {"e1c1384cb4d2221dfdd7c795a4222c9a", "size: a.out: bad magic"},
md5Test{"c90f3ddecc54f34228c063d7525bf644", "The major problem is with sendmail. -Mark Horton"}, {"c90f3ddecc54f34228c063d7525bf644", "The major problem is with sendmail. -Mark Horton"},
md5Test{"cdf7ab6c1fd49bd9933c43f3ea5af185", "Give me a rock, paper and scissors and I will move the world. CCFestoon"}, {"cdf7ab6c1fd49bd9933c43f3ea5af185", "Give me a rock, paper and scissors and I will move the world. CCFestoon"},
md5Test{"83bc85234942fc883c063cbd7f0ad5d0", "If the enemy is within range, then so are you."}, {"83bc85234942fc883c063cbd7f0ad5d0", "If the enemy is within range, then so are you."},
md5Test{"277cbe255686b48dd7e8f389394d9299", "It's well we cannot hear the screams/That we create in others' dreams."}, {"277cbe255686b48dd7e8f389394d9299", "It's well we cannot hear the screams/That we create in others' dreams."},
md5Test{"fd3fb0a7ffb8af16603f3d3af98f8e1f", "You remind me of a TV show, but that's all right: I watch it anyway."}, {"fd3fb0a7ffb8af16603f3d3af98f8e1f", "You remind me of a TV show, but that's all right: I watch it anyway."},
md5Test{"469b13a78ebf297ecda64d4723655154", "C is as portable as Stonehedge!!"}, {"469b13a78ebf297ecda64d4723655154", "C is as portable as Stonehedge!!"},
md5Test{"63eb3a2f466410104731c4b037600110", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"}, {"63eb3a2f466410104731c4b037600110", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"},
md5Test{"72c2ed7592debca1c90fc0100f931a2f", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"}, {"72c2ed7592debca1c90fc0100f931a2f", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"},
md5Test{"132f7619d33b523b1d9e5bd8e0928355", "How can you write a big system without C++? -Paul Glick"}, {"132f7619d33b523b1d9e5bd8e0928355", "How can you write a big system without C++? -Paul Glick"},
} }
func TestGolden(t *testing.T) { func TestGolden(t *testing.T) {
......
...@@ -15,25 +15,25 @@ type rc4Test struct { ...@@ -15,25 +15,25 @@ type rc4Test struct {
var golden = []rc4Test{ var golden = []rc4Test{
// Test vectors from the original cypherpunk posting of ARC4: // Test vectors from the original cypherpunk posting of ARC4:
// http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0?pli=1 // http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0?pli=1
rc4Test{ {
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
[]byte{0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79}, []byte{0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79},
}, },
rc4Test{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a}, []byte{0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a},
}, },
rc4Test{ {
[]byte{0xef, 0x01, 0x23, 0x45}, []byte{0xef, 0x01, 0x23, 0x45},
[]byte{0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, 0xbd, 0x61}, []byte{0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, 0xbd, 0x61},
}, },
// Test vectors from the Wikipedia page: http://en.wikipedia.org/wiki/RC4 // Test vectors from the Wikipedia page: http://en.wikipedia.org/wiki/RC4
rc4Test{ {
[]byte{0x4b, 0x65, 0x79}, []byte{0x4b, 0x65, 0x79},
[]byte{0xeb, 0x9f, 0x77, 0x81, 0xb7, 0x34, 0xca, 0x72, 0xa7, 0x19}, []byte{0xeb, 0x9f, 0x77, 0x81, 0xb7, 0x34, 0xca, 0x72, 0xa7, 0x19},
}, },
rc4Test{ {
[]byte{0x57, 0x69, 0x6b, 0x69}, []byte{0x57, 0x69, 0x6b, 0x69},
[]byte{0x60, 0x44, 0xdb, 0x6d, 0x41, 0xb7}, []byte{0x60, 0x44, 0xdb, 0x6d, 0x41, 0xb7},
}, },
......
...@@ -19,14 +19,14 @@ type mdTest struct { ...@@ -19,14 +19,14 @@ type mdTest struct {
} }
var vectors = [...]mdTest{ var vectors = [...]mdTest{
mdTest{"9c1185a5c5e9fc54612808977ee8f548b2258d31", ""}, {"9c1185a5c5e9fc54612808977ee8f548b2258d31", ""},
mdTest{"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", "a"}, {"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", "a"},
mdTest{"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", "abc"}, {"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", "abc"},
mdTest{"5d0689ef49d2fae572b881b123a85ffa21595f36", "message digest"}, {"5d0689ef49d2fae572b881b123a85ffa21595f36", "message digest"},
mdTest{"f71c27109c692c1b56bbdceb5b9d2865b3708dbc", "abcdefghijklmnopqrstuvwxyz"}, {"f71c27109c692c1b56bbdceb5b9d2865b3708dbc", "abcdefghijklmnopqrstuvwxyz"},
mdTest{"12a053384a9c0c88e405a06c27dcf49ada62eb2b", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"}, {"12a053384a9c0c88e405a06c27dcf49ada62eb2b", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"},
mdTest{"b0e20b6e3116640286ed3a87a5713079b21f5189", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}, {"b0e20b6e3116640286ed3a87a5713079b21f5189", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},
mdTest{"9b752e45573d4b39f4dbd3323cab82bf63326bfb", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"}, {"9b752e45573d4b39f4dbd3323cab82bf63326bfb", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"},
} }
func TestVectors(t *testing.T) { func TestVectors(t *testing.T) {
......
...@@ -159,17 +159,17 @@ const ( ...@@ -159,17 +159,17 @@ const (
// with the correct contents. // with the correct contents.
var hashPrefixes = [][]byte{ var hashPrefixes = [][]byte{
// HashMD5 // HashMD5
[]byte{0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10}, {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10},
// HashSHA1 // HashSHA1
[]byte{0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14}, {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14},
// HashSHA256 // HashSHA256
[]byte{0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20}, {0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20},
// HashSHA384 // HashSHA384
[]byte{0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30}, {0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30},
// HashSHA512 // HashSHA512
[]byte{0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40}, {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40},
// HashMD5SHA1 // HashMD5SHA1
[]byte{}, // A special TLS case which doesn't use an ASN1 prefix. {}, // A special TLS case which doesn't use an ASN1 prefix.
} }
// SignPKCS1v15 calcuates the signature of hashed using RSASSA-PSS-SIGN from RSA PKCS#1 v1.5. // SignPKCS1v15 calcuates the signature of hashed using RSASSA-PSS-SIGN from RSA PKCS#1 v1.5.
......
...@@ -31,19 +31,19 @@ type DecryptPKCS1v15Test struct { ...@@ -31,19 +31,19 @@ type DecryptPKCS1v15Test struct {
// These test vectors were generated with `openssl rsautl -pkcs -encrypt` // These test vectors were generated with `openssl rsautl -pkcs -encrypt`
var decryptPKCS1v15Tests = []DecryptPKCS1v15Test{ var decryptPKCS1v15Tests = []DecryptPKCS1v15Test{
DecryptPKCS1v15Test{ {
"gIcUIoVkD6ATMBk/u/nlCZCCWRKdkfjCgFdo35VpRXLduiKXhNz1XupLLzTXAybEq15juc+EgY5o0DHv/nt3yg==", "gIcUIoVkD6ATMBk/u/nlCZCCWRKdkfjCgFdo35VpRXLduiKXhNz1XupLLzTXAybEq15juc+EgY5o0DHv/nt3yg==",
"x", "x",
}, },
DecryptPKCS1v15Test{ {
"Y7TOCSqofGhkRb+jaVRLzK8xw2cSo1IVES19utzv6hwvx+M8kFsoWQm5DzBeJCZTCVDPkTpavUuEbgp8hnUGDw==", "Y7TOCSqofGhkRb+jaVRLzK8xw2cSo1IVES19utzv6hwvx+M8kFsoWQm5DzBeJCZTCVDPkTpavUuEbgp8hnUGDw==",
"testing.", "testing.",
}, },
DecryptPKCS1v15Test{ {
"arReP9DJtEVyV2Dg3dDp4c/PSk1O6lxkoJ8HcFupoRorBZG+7+1fDAwT1olNddFnQMjmkb8vxwmNMoTAT/BFjQ==", "arReP9DJtEVyV2Dg3dDp4c/PSk1O6lxkoJ8HcFupoRorBZG+7+1fDAwT1olNddFnQMjmkb8vxwmNMoTAT/BFjQ==",
"testing.\n", "testing.\n",
}, },
DecryptPKCS1v15Test{ {
"WtaBXIoGC54+vH0NH0CHHE+dRDOsMc/6BrfFu2lEqcKL9+uDuWaf+Xj9mrbQCjjZcpQuX733zyok/jsnqe/Ftw==", "WtaBXIoGC54+vH0NH0CHHE+dRDOsMc/6BrfFu2lEqcKL9+uDuWaf+Xj9mrbQCjjZcpQuX733zyok/jsnqe/Ftw==",
"01234567890123456789012345678901234567890123456789012", "01234567890123456789012345678901234567890123456789012",
}, },
...@@ -101,19 +101,19 @@ func TestEncryptPKCS1v15(t *testing.T) { ...@@ -101,19 +101,19 @@ func TestEncryptPKCS1v15(t *testing.T) {
// These test vectors were generated with `openssl rsautl -pkcs -encrypt` // These test vectors were generated with `openssl rsautl -pkcs -encrypt`
var decryptPKCS1v15SessionKeyTests = []DecryptPKCS1v15Test{ var decryptPKCS1v15SessionKeyTests = []DecryptPKCS1v15Test{
DecryptPKCS1v15Test{ {
"e6ukkae6Gykq0fKzYwULpZehX+UPXYzMoB5mHQUDEiclRbOTqas4Y0E6nwns1BBpdvEJcilhl5zsox/6DtGsYg==", "e6ukkae6Gykq0fKzYwULpZehX+UPXYzMoB5mHQUDEiclRbOTqas4Y0E6nwns1BBpdvEJcilhl5zsox/6DtGsYg==",
"1234", "1234",
}, },
DecryptPKCS1v15Test{ {
"Dtis4uk/q/LQGGqGk97P59K03hkCIVFMEFZRgVWOAAhxgYpCRG0MX2adptt92l67IqMki6iVQyyt0TtX3IdtEw==", "Dtis4uk/q/LQGGqGk97P59K03hkCIVFMEFZRgVWOAAhxgYpCRG0MX2adptt92l67IqMki6iVQyyt0TtX3IdtEw==",
"FAIL", "FAIL",
}, },
DecryptPKCS1v15Test{ {
"LIyFyCYCptPxrvTxpol8F3M7ZivlMsf53zs0vHRAv+rDIh2YsHS69ePMoPMe3TkOMZ3NupiL3takPxIs1sK+dw==", "LIyFyCYCptPxrvTxpol8F3M7ZivlMsf53zs0vHRAv+rDIh2YsHS69ePMoPMe3TkOMZ3NupiL3takPxIs1sK+dw==",
"abcd", "abcd",
}, },
DecryptPKCS1v15Test{ {
"bafnobel46bKy76JzqU/RIVOH0uAYvzUtauKmIidKgM0sMlvobYVAVQPeUQ/oTGjbIZ1v/6Gyi5AO4DtHruGdw==", "bafnobel46bKy76JzqU/RIVOH0uAYvzUtauKmIidKgM0sMlvobYVAVQPeUQ/oTGjbIZ1v/6Gyi5AO4DtHruGdw==",
"FAIL", "FAIL",
}, },
...@@ -156,7 +156,7 @@ type signPKCS1v15Test struct { ...@@ -156,7 +156,7 @@ type signPKCS1v15Test struct {
// These vectors have been tested with // These vectors have been tested with
// `openssl rsautl -verify -inkey pk -in signature | hexdump -C` // `openssl rsautl -verify -inkey pk -in signature | hexdump -C`
var signPKCS1v15Tests = []signPKCS1v15Test{ var signPKCS1v15Tests = []signPKCS1v15Test{
signPKCS1v15Test{"Test.\n", "a4f3fa6ea93bcdd0c57be020c1193ecbfd6f200a3d95c409769b029578fa0e336ad9a347600e40d3ae823b8c7e6bad88cc07c1d54c3a1523cbbb6d58efc362ae"}, {"Test.\n", "a4f3fa6ea93bcdd0c57be020c1193ecbfd6f200a3d95c409769b029578fa0e336ad9a347600e40d3ae823b8c7e6bad88cc07c1d54c3a1523cbbb6d58efc362ae"},
} }
func TestSignPKCS1v15(t *testing.T) { func TestSignPKCS1v15(t *testing.T) {
......
...@@ -105,12 +105,12 @@ func TestDecryptOAEP(t *testing.T) { ...@@ -105,12 +105,12 @@ func TestDecryptOAEP(t *testing.T) {
// testEncryptOAEPData contains a subset of the vectors from RSA's "Test vectors for RSA-OAEP". // testEncryptOAEPData contains a subset of the vectors from RSA's "Test vectors for RSA-OAEP".
var testEncryptOAEPData = []testEncryptOAEPStruct{ var testEncryptOAEPData = []testEncryptOAEPStruct{
// Key 1 // Key 1
testEncryptOAEPStruct{"a8b3b284af8eb50b387034a860f146c4919f318763cd6c5598c8ae4811a1e0abc4c7e0b082d693a5e7fced675cf4668512772c0cbc64a742c6c630f533c8cc72f62ae833c40bf25842e984bb78bdbf97c0107d55bdb662f5c4e0fab9845cb5148ef7392dd3aaff93ae1e6b667bb3d4247616d4f5ba10d4cfd226de88d39f16fb", {"a8b3b284af8eb50b387034a860f146c4919f318763cd6c5598c8ae4811a1e0abc4c7e0b082d693a5e7fced675cf4668512772c0cbc64a742c6c630f533c8cc72f62ae833c40bf25842e984bb78bdbf97c0107d55bdb662f5c4e0fab9845cb5148ef7392dd3aaff93ae1e6b667bb3d4247616d4f5ba10d4cfd226de88d39f16fb",
65537, 65537,
"53339cfdb79fc8466a655c7316aca85c55fd8f6dd898fdaf119517ef4f52e8fd8e258df93fee180fa0e4ab29693cd83b152a553d4ac4d1812b8b9fa5af0e7f55fe7304df41570926f3311f15c4d65a732c483116ee3d3d2d0af3549ad9bf7cbfb78ad884f84d5beb04724dc7369b31def37d0cf539e9cfcdd3de653729ead5d1", "53339cfdb79fc8466a655c7316aca85c55fd8f6dd898fdaf119517ef4f52e8fd8e258df93fee180fa0e4ab29693cd83b152a553d4ac4d1812b8b9fa5af0e7f55fe7304df41570926f3311f15c4d65a732c483116ee3d3d2d0af3549ad9bf7cbfb78ad884f84d5beb04724dc7369b31def37d0cf539e9cfcdd3de653729ead5d1",
[]testEncryptOAEPMessage{ []testEncryptOAEPMessage{
// Example 1.1 // Example 1.1
testEncryptOAEPMessage{ {
[]byte{0x66, 0x28, 0x19, 0x4e, 0x12, 0x07, 0x3d, 0xb0, []byte{0x66, 0x28, 0x19, 0x4e, 0x12, 0x07, 0x3d, 0xb0,
0x3b, 0xa9, 0x4c, 0xda, 0x9e, 0xf9, 0x53, 0x23, 0x97, 0x3b, 0xa9, 0x4c, 0xda, 0x9e, 0xf9, 0x53, 0x23, 0x97,
0xd5, 0x0d, 0xba, 0x79, 0xb9, 0x87, 0x00, 0x4a, 0xfe, 0xd5, 0x0d, 0xba, 0x79, 0xb9, 0x87, 0x00, 0x4a, 0xfe,
...@@ -138,7 +138,7 @@ var testEncryptOAEPData = []testEncryptOAEPStruct{ ...@@ -138,7 +138,7 @@ var testEncryptOAEPData = []testEncryptOAEPStruct{
}, },
}, },
// Example 1.2 // Example 1.2
testEncryptOAEPMessage{ {
[]byte{0x75, 0x0c, 0x40, 0x47, 0xf5, 0x47, 0xe8, 0xe4, []byte{0x75, 0x0c, 0x40, 0x47, 0xf5, 0x47, 0xe8, 0xe4,
0x14, 0x11, 0x85, 0x65, 0x23, 0x29, 0x8a, 0xc9, 0xba, 0x14, 0x11, 0x85, 0x65, 0x23, 0x29, 0x8a, 0xc9, 0xba,
0xe2, 0x45, 0xef, 0xaf, 0x13, 0x97, 0xfb, 0xe5, 0x6f, 0xe2, 0x45, 0xef, 0xaf, 0x13, 0x97, 0xfb, 0xe5, 0x6f,
...@@ -166,7 +166,7 @@ var testEncryptOAEPData = []testEncryptOAEPStruct{ ...@@ -166,7 +166,7 @@ var testEncryptOAEPData = []testEncryptOAEPStruct{
}, },
}, },
// Example 1.3 // Example 1.3
testEncryptOAEPMessage{ {
[]byte{0xd9, 0x4a, 0xe0, 0x83, 0x2e, 0x64, 0x45, 0xce, []byte{0xd9, 0x4a, 0xe0, 0x83, 0x2e, 0x64, 0x45, 0xce,
0x42, 0x33, 0x1c, 0xb0, 0x6d, 0x53, 0x1a, 0x82, 0xb1, 0x42, 0x33, 0x1c, 0xb0, 0x6d, 0x53, 0x1a, 0x82, 0xb1,
0xdb, 0x4b, 0xaa, 0xd3, 0x0f, 0x74, 0x6d, 0xc9, 0x16, 0xdb, 0x4b, 0xaa, 0xd3, 0x0f, 0x74, 0x6d, 0xc9, 0x16,
...@@ -199,12 +199,12 @@ var testEncryptOAEPData = []testEncryptOAEPStruct{ ...@@ -199,12 +199,12 @@ var testEncryptOAEPData = []testEncryptOAEPStruct{
}, },
}, },
// Key 10 // Key 10
testEncryptOAEPStruct{"ae45ed5601cec6b8cc05f803935c674ddbe0d75c4c09fd7951fc6b0caec313a8df39970c518bffba5ed68f3f0d7f22a4029d413f1ae07e4ebe9e4177ce23e7f5404b569e4ee1bdcf3c1fb03ef113802d4f855eb9b5134b5a7c8085adcae6fa2fa1417ec3763be171b0c62b760ede23c12ad92b980884c641f5a8fac26bdad4a03381a22fe1b754885094c82506d4019a535a286afeb271bb9ba592de18dcf600c2aeeae56e02f7cf79fc14cf3bdc7cd84febbbf950ca90304b2219a7aa063aefa2c3c1980e560cd64afe779585b6107657b957857efde6010988ab7de417fc88d8f384c4e6e72c3f943e0c31c0c4a5cc36f879d8a3ac9d7d59860eaada6b83bb", {"ae45ed5601cec6b8cc05f803935c674ddbe0d75c4c09fd7951fc6b0caec313a8df39970c518bffba5ed68f3f0d7f22a4029d413f1ae07e4ebe9e4177ce23e7f5404b569e4ee1bdcf3c1fb03ef113802d4f855eb9b5134b5a7c8085adcae6fa2fa1417ec3763be171b0c62b760ede23c12ad92b980884c641f5a8fac26bdad4a03381a22fe1b754885094c82506d4019a535a286afeb271bb9ba592de18dcf600c2aeeae56e02f7cf79fc14cf3bdc7cd84febbbf950ca90304b2219a7aa063aefa2c3c1980e560cd64afe779585b6107657b957857efde6010988ab7de417fc88d8f384c4e6e72c3f943e0c31c0c4a5cc36f879d8a3ac9d7d59860eaada6b83bb",
65537, 65537,
"056b04216fe5f354ac77250a4b6b0c8525a85c59b0bd80c56450a22d5f438e596a333aa875e291dd43f48cb88b9d5fc0d499f9fcd1c397f9afc070cd9e398c8d19e61db7c7410a6b2675dfbf5d345b804d201add502d5ce2dfcb091ce9997bbebe57306f383e4d588103f036f7e85d1934d152a323e4a8db451d6f4a5b1b0f102cc150e02feee2b88dea4ad4c1baccb24d84072d14e1d24a6771f7408ee30564fb86d4393a34bcf0b788501d193303f13a2284b001f0f649eaf79328d4ac5c430ab4414920a9460ed1b7bc40ec653e876d09abc509ae45b525190116a0c26101848298509c1c3bf3a483e7274054e15e97075036e989f60932807b5257751e79", "056b04216fe5f354ac77250a4b6b0c8525a85c59b0bd80c56450a22d5f438e596a333aa875e291dd43f48cb88b9d5fc0d499f9fcd1c397f9afc070cd9e398c8d19e61db7c7410a6b2675dfbf5d345b804d201add502d5ce2dfcb091ce9997bbebe57306f383e4d588103f036f7e85d1934d152a323e4a8db451d6f4a5b1b0f102cc150e02feee2b88dea4ad4c1baccb24d84072d14e1d24a6771f7408ee30564fb86d4393a34bcf0b788501d193303f13a2284b001f0f649eaf79328d4ac5c430ab4414920a9460ed1b7bc40ec653e876d09abc509ae45b525190116a0c26101848298509c1c3bf3a483e7274054e15e97075036e989f60932807b5257751e79",
[]testEncryptOAEPMessage{ []testEncryptOAEPMessage{
// Example 10.1 // Example 10.1
testEncryptOAEPMessage{ {
[]byte{0x8b, 0xba, 0x6b, 0xf8, 0x2a, 0x6c, 0x0f, 0x86, []byte{0x8b, 0xba, 0x6b, 0xf8, 0x2a, 0x6c, 0x0f, 0x86,
0xd5, 0xf1, 0x75, 0x6e, 0x97, 0x95, 0x68, 0x70, 0xb0, 0xd5, 0xf1, 0x75, 0x6e, 0x97, 0x95, 0x68, 0x70, 0xb0,
0x89, 0x53, 0xb0, 0x6b, 0x4e, 0xb2, 0x05, 0xbc, 0x16, 0x89, 0x53, 0xb0, 0x6b, 0x4e, 0xb2, 0x05, 0xbc, 0x16,
......
...@@ -18,37 +18,37 @@ type sha1Test struct { ...@@ -18,37 +18,37 @@ type sha1Test struct {
} }
var golden = []sha1Test{ var golden = []sha1Test{
sha1Test{"da39a3ee5e6b4b0d3255bfef95601890afd80709", ""}, {"da39a3ee5e6b4b0d3255bfef95601890afd80709", ""},
sha1Test{"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8", "a"}, {"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8", "a"},
sha1Test{"da23614e02469a0d7c7bd1bdab5c9c474b1904dc", "ab"}, {"da23614e02469a0d7c7bd1bdab5c9c474b1904dc", "ab"},
sha1Test{"a9993e364706816aba3e25717850c26c9cd0d89d", "abc"}, {"a9993e364706816aba3e25717850c26c9cd0d89d", "abc"},
sha1Test{"81fe8bfe87576c3ecb22426f8e57847382917acf", "abcd"}, {"81fe8bfe87576c3ecb22426f8e57847382917acf", "abcd"},
sha1Test{"03de6c570bfe24bfc328ccd7ca46b76eadaf4334", "abcde"}, {"03de6c570bfe24bfc328ccd7ca46b76eadaf4334", "abcde"},
sha1Test{"1f8ac10f23c5b5bc1167bda84b833e5c057a77d2", "abcdef"}, {"1f8ac10f23c5b5bc1167bda84b833e5c057a77d2", "abcdef"},
sha1Test{"2fb5e13419fc89246865e7a324f476ec624e8740", "abcdefg"}, {"2fb5e13419fc89246865e7a324f476ec624e8740", "abcdefg"},
sha1Test{"425af12a0743502b322e93a015bcf868e324d56a", "abcdefgh"}, {"425af12a0743502b322e93a015bcf868e324d56a", "abcdefgh"},
sha1Test{"c63b19f1e4c8b5f76b25c49b8b87f57d8e4872a1", "abcdefghi"}, {"c63b19f1e4c8b5f76b25c49b8b87f57d8e4872a1", "abcdefghi"},
sha1Test{"d68c19a0a345b7eab78d5e11e991c026ec60db63", "abcdefghij"}, {"d68c19a0a345b7eab78d5e11e991c026ec60db63", "abcdefghij"},
sha1Test{"ebf81ddcbe5bf13aaabdc4d65354fdf2044f38a7", "Discard medicine more than two years old."}, {"ebf81ddcbe5bf13aaabdc4d65354fdf2044f38a7", "Discard medicine more than two years old."},
sha1Test{"e5dea09392dd886ca63531aaa00571dc07554bb6", "He who has a shady past knows that nice guys finish last."}, {"e5dea09392dd886ca63531aaa00571dc07554bb6", "He who has a shady past knows that nice guys finish last."},
sha1Test{"45988f7234467b94e3e9494434c96ee3609d8f8f", "I wouldn't marry him with a ten foot pole."}, {"45988f7234467b94e3e9494434c96ee3609d8f8f", "I wouldn't marry him with a ten foot pole."},
sha1Test{"55dee037eb7460d5a692d1ce11330b260e40c988", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"}, {"55dee037eb7460d5a692d1ce11330b260e40c988", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"},
sha1Test{"b7bc5fb91080c7de6b582ea281f8a396d7c0aee8", "The days of the digital watch are numbered. -Tom Stoppard"}, {"b7bc5fb91080c7de6b582ea281f8a396d7c0aee8", "The days of the digital watch are numbered. -Tom Stoppard"},
sha1Test{"c3aed9358f7c77f523afe86135f06b95b3999797", "Nepal premier won't resign."}, {"c3aed9358f7c77f523afe86135f06b95b3999797", "Nepal premier won't resign."},
sha1Test{"6e29d302bf6e3a5e4305ff318d983197d6906bb9", "For every action there is an equal and opposite government program."}, {"6e29d302bf6e3a5e4305ff318d983197d6906bb9", "For every action there is an equal and opposite government program."},
sha1Test{"597f6a540010f94c15d71806a99a2c8710e747bd", "His money is twice tainted: 'taint yours and 'taint mine."}, {"597f6a540010f94c15d71806a99a2c8710e747bd", "His money is twice tainted: 'taint yours and 'taint mine."},
sha1Test{"6859733b2590a8a091cecf50086febc5ceef1e80", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"}, {"6859733b2590a8a091cecf50086febc5ceef1e80", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"},
sha1Test{"514b2630ec089b8aee18795fc0cf1f4860cdacad", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"}, {"514b2630ec089b8aee18795fc0cf1f4860cdacad", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"},
sha1Test{"c5ca0d4a7b6676fc7aa72caa41cc3d5df567ed69", "size: a.out: bad magic"}, {"c5ca0d4a7b6676fc7aa72caa41cc3d5df567ed69", "size: a.out: bad magic"},
sha1Test{"74c51fa9a04eadc8c1bbeaa7fc442f834b90a00a", "The major problem is with sendmail. -Mark Horton"}, {"74c51fa9a04eadc8c1bbeaa7fc442f834b90a00a", "The major problem is with sendmail. -Mark Horton"},
sha1Test{"0b4c4ce5f52c3ad2821852a8dc00217fa18b8b66", "Give me a rock, paper and scissors and I will move the world. CCFestoon"}, {"0b4c4ce5f52c3ad2821852a8dc00217fa18b8b66", "Give me a rock, paper and scissors and I will move the world. CCFestoon"},
sha1Test{"3ae7937dd790315beb0f48330e8642237c61550a", "If the enemy is within range, then so are you."}, {"3ae7937dd790315beb0f48330e8642237c61550a", "If the enemy is within range, then so are you."},
sha1Test{"410a2b296df92b9a47412b13281df8f830a9f44b", "It's well we cannot hear the screams/That we create in others' dreams."}, {"410a2b296df92b9a47412b13281df8f830a9f44b", "It's well we cannot hear the screams/That we create in others' dreams."},
sha1Test{"841e7c85ca1adcddbdd0187f1289acb5c642f7f5", "You remind me of a TV show, but that's all right: I watch it anyway."}, {"841e7c85ca1adcddbdd0187f1289acb5c642f7f5", "You remind me of a TV show, but that's all right: I watch it anyway."},
sha1Test{"163173b825d03b952601376b25212df66763e1db", "C is as portable as Stonehedge!!"}, {"163173b825d03b952601376b25212df66763e1db", "C is as portable as Stonehedge!!"},
sha1Test{"32b0377f2687eb88e22106f133c586ab314d5279", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"}, {"32b0377f2687eb88e22106f133c586ab314d5279", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"},
sha1Test{"0885aaf99b569542fd165fa44e322718f4a984e0", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"}, {"0885aaf99b569542fd165fa44e322718f4a984e0", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"},
sha1Test{"6627d6904d71420b0bf3886ab629623538689f45", "How can you write a big system without C++? -Paul Glick"}, {"6627d6904d71420b0bf3886ab629623538689f45", "How can you write a big system without C++? -Paul Glick"},
} }
func TestGolden(t *testing.T) { func TestGolden(t *testing.T) {
......
This diff is collapsed.
This diff is collapsed.
...@@ -15,9 +15,9 @@ type TestConstantTimeCompareStruct struct { ...@@ -15,9 +15,9 @@ type TestConstantTimeCompareStruct struct {
} }
var testConstandTimeCompareData = []TestConstantTimeCompareStruct{ var testConstandTimeCompareData = []TestConstantTimeCompareStruct{
TestConstantTimeCompareStruct{[]byte{}, []byte{}, 1}, {[]byte{}, []byte{}, 1},
TestConstantTimeCompareStruct{[]byte{0x11}, []byte{0x11}, 1}, {[]byte{0x11}, []byte{0x11}, 1},
TestConstantTimeCompareStruct{[]byte{0x12}, []byte{0x11}, 0}, {[]byte{0x12}, []byte{0x11}, 0},
} }
func TestConstantTimeCompare(t *testing.T) { func TestConstantTimeCompare(t *testing.T) {
...@@ -34,11 +34,11 @@ type TestConstantTimeByteEqStruct struct { ...@@ -34,11 +34,11 @@ type TestConstantTimeByteEqStruct struct {
} }
var testConstandTimeByteEqData = []TestConstantTimeByteEqStruct{ var testConstandTimeByteEqData = []TestConstantTimeByteEqStruct{
TestConstantTimeByteEqStruct{0, 0, 1}, {0, 0, 1},
TestConstantTimeByteEqStruct{0, 1, 0}, {0, 1, 0},
TestConstantTimeByteEqStruct{1, 0, 0}, {1, 0, 0},
TestConstantTimeByteEqStruct{0xff, 0xff, 1}, {0xff, 0xff, 1},
TestConstantTimeByteEqStruct{0xff, 0xfe, 0}, {0xff, 0xfe, 0},
} }
func byteEq(a, b uint8) int { func byteEq(a, b uint8) int {
......
...@@ -29,7 +29,7 @@ type cipherSuite struct { ...@@ -29,7 +29,7 @@ type cipherSuite struct {
} }
var cipherSuites = []cipherSuite{ var cipherSuites = []cipherSuite{
cipherSuite{TLS_RSA_WITH_RC4_128_SHA, 20, 16}, {TLS_RSA_WITH_RC4_128_SHA, 20, 16},
} }
func (c *Conn) serverHandshake() os.Error { func (c *Conn) serverHandshake() os.Error {
......
...@@ -187,7 +187,7 @@ var testPrivateKey = &rsa.PrivateKey{ ...@@ -187,7 +187,7 @@ var testPrivateKey = &rsa.PrivateKey{
// to dump a session. // to dump a session.
var serverScript = [][]byte{ var serverScript = [][]byte{
// Alternate write and read. // Alternate write and read.
[]byte{ {
0x16, 0x03, 0x02, 0x00, 0x71, 0x01, 0x00, 0x00, 0x6d, 0x03, 0x02, 0x4b, 0xd4, 0xee, 0x6e, 0xab, 0x16, 0x03, 0x02, 0x00, 0x71, 0x01, 0x00, 0x00, 0x6d, 0x03, 0x02, 0x4b, 0xd4, 0xee, 0x6e, 0xab,
0x0b, 0xc3, 0x01, 0xd6, 0x8d, 0xe0, 0x72, 0x7e, 0x6c, 0x04, 0xbe, 0x9a, 0x3c, 0xa3, 0xd8, 0x95, 0x0b, 0xc3, 0x01, 0xd6, 0x8d, 0xe0, 0x72, 0x7e, 0x6c, 0x04, 0xbe, 0x9a, 0x3c, 0xa3, 0xd8, 0x95,
0x28, 0x00, 0xb2, 0xe8, 0x1f, 0xdd, 0xb0, 0xec, 0xca, 0x46, 0x1f, 0x00, 0x00, 0x28, 0x00, 0x33, 0x28, 0x00, 0xb2, 0xe8, 0x1f, 0xdd, 0xb0, 0xec, 0xca, 0x46, 0x1f, 0x00, 0x00, 0x28, 0x00, 0x33,
...@@ -198,7 +198,7 @@ var serverScript = [][]byte{ ...@@ -198,7 +198,7 @@ var serverScript = [][]byte{
0x38, 0x2e, 0x30, 0x2e, 0x31, 0x30, 0x38, 0x2e, 0x30, 0x2e, 0x31, 0x30,
}, },
[]byte{ {
0x16, 0x03, 0x02, 0x00, 0x2a, 0x16, 0x03, 0x02, 0x00, 0x2a,
0x02, 0x00, 0x00, 0x26, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x26, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
...@@ -253,7 +253,7 @@ var serverScript = [][]byte{ ...@@ -253,7 +253,7 @@ var serverScript = [][]byte{
0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
}, },
[]byte{ {
0x16, 0x03, 0x02, 0x00, 0x86, 0x10, 0x00, 0x00, 0x82, 0x00, 0x80, 0x3b, 0x7a, 0x9b, 0x05, 0xfd, 0x16, 0x03, 0x02, 0x00, 0x86, 0x10, 0x00, 0x00, 0x82, 0x00, 0x80, 0x3b, 0x7a, 0x9b, 0x05, 0xfd,
0x1b, 0x0d, 0x81, 0xf0, 0xac, 0x59, 0x57, 0x4e, 0xb6, 0xf5, 0x81, 0xed, 0x52, 0x78, 0xc5, 0xff, 0x1b, 0x0d, 0x81, 0xf0, 0xac, 0x59, 0x57, 0x4e, 0xb6, 0xf5, 0x81, 0xed, 0x52, 0x78, 0xc5, 0xff,
0x36, 0x33, 0x9c, 0x94, 0x31, 0xc3, 0x14, 0x98, 0x5d, 0xa0, 0x49, 0x23, 0x11, 0x67, 0xdf, 0x73, 0x36, 0x33, 0x9c, 0x94, 0x31, 0xc3, 0x14, 0x98, 0x5d, 0xa0, 0x49, 0x23, 0x11, 0x67, 0xdf, 0x73,
...@@ -271,7 +271,7 @@ var serverScript = [][]byte{ ...@@ -271,7 +271,7 @@ var serverScript = [][]byte{
0xa0, 0xb7, 0x8c, 0x9d, 0x24, 0xbd, 0x99, 0x33, 0x1e, 0xa0, 0xb7, 0x8c, 0x9d, 0x24, 0xbd, 0x99, 0x33, 0x1e,
}, },
[]byte{ {
0x14, 0x03, 0x02, 0x00, 0x01, 0x14, 0x03, 0x02, 0x00, 0x01,
0x01, 0x01,
......
...@@ -14,11 +14,11 @@ type testSplitPreMasterSecretTest struct { ...@@ -14,11 +14,11 @@ type testSplitPreMasterSecretTest struct {
} }
var testSplitPreMasterSecretTests = []testSplitPreMasterSecretTest{ var testSplitPreMasterSecretTests = []testSplitPreMasterSecretTest{
testSplitPreMasterSecretTest{"", "", ""}, {"", "", ""},
testSplitPreMasterSecretTest{"00", "00", "00"}, {"00", "00", "00"},
testSplitPreMasterSecretTest{"0011", "00", "11"}, {"0011", "00", "11"},
testSplitPreMasterSecretTest{"001122", "0011", "1122"}, {"001122", "0011", "1122"},
testSplitPreMasterSecretTest{"00112233", "0011", "2233"}, {"00112233", "0011", "2233"},
} }
func TestSplitPreMasterSecret(t *testing.T) { func TestSplitPreMasterSecret(t *testing.T) {
...@@ -65,7 +65,7 @@ func TestKeysFromPreMasterSecret(t *testing.T) { ...@@ -65,7 +65,7 @@ func TestKeysFromPreMasterSecret(t *testing.T) {
// These test vectors were generated from GnuTLS using `gnutls-cli --insecure -d 9 ` // These test vectors were generated from GnuTLS using `gnutls-cli --insecure -d 9 `
var testKeysFromTests = []testKeysFromTest{ var testKeysFromTests = []testKeysFromTest{
testKeysFromTest{ {
"0302cac83ad4b1db3b9ab49ad05957de2a504a634a386fc600889321e1a971f57479466830ac3e6f468e87f5385fa0c5", "0302cac83ad4b1db3b9ab49ad05957de2a504a634a386fc600889321e1a971f57479466830ac3e6f468e87f5385fa0c5",
"4ae66303755184a3917fcb44880605fcc53baa01912b22ed94473fc69cebd558", "4ae66303755184a3917fcb44880605fcc53baa01912b22ed94473fc69cebd558",
"4ae663020ec16e6bb5130be918cfcafd4d765979a3136a5d50c593446e4e44db", "4ae663020ec16e6bb5130be918cfcafd4d765979a3136a5d50c593446e4e44db",
...@@ -77,7 +77,7 @@ var testKeysFromTests = []testKeysFromTest{ ...@@ -77,7 +77,7 @@ var testKeysFromTests = []testKeysFromTest{
20, 20,
16, 16,
}, },
testKeysFromTest{ {
"03023f7527316bc12cbcd69e4b9e8275d62c028f27e65c745cfcddc7ce01bd3570a111378b63848127f1c36e5f9e4890", "03023f7527316bc12cbcd69e4b9e8275d62c028f27e65c745cfcddc7ce01bd3570a111378b63848127f1c36e5f9e4890",
"4ae66364b5ea56b20ce4e25555aed2d7e67f42788dd03f3fee4adae0459ab106", "4ae66364b5ea56b20ce4e25555aed2d7e67f42788dd03f3fee4adae0459ab106",
"4ae66363ab815cbf6a248b87d6b556184e945e9b97fbdf247858b0bdafacfa1c", "4ae66363ab815cbf6a248b87d6b556184e945e9b97fbdf247858b0bdafacfa1c",
...@@ -89,7 +89,7 @@ var testKeysFromTests = []testKeysFromTest{ ...@@ -89,7 +89,7 @@ var testKeysFromTests = []testKeysFromTest{
20, 20,
16, 16,
}, },
testKeysFromTest{ {
"832d515f1d61eebb2be56ba0ef79879efb9b527504abb386fb4310ed5d0e3b1f220d3bb6b455033a2773e6d8bdf951d278a187482b400d45deb88a5d5a6bb7d6a7a1decc04eb9ef0642876cd4a82d374d3b6ff35f0351dc5d411104de431375355addc39bfb1f6329fb163b0bc298d658338930d07d313cd980a7e3d9196cac1", "832d515f1d61eebb2be56ba0ef79879efb9b527504abb386fb4310ed5d0e3b1f220d3bb6b455033a2773e6d8bdf951d278a187482b400d45deb88a5d5a6bb7d6a7a1decc04eb9ef0642876cd4a82d374d3b6ff35f0351dc5d411104de431375355addc39bfb1f6329fb163b0bc298d658338930d07d313cd980a7e3d9196cac1",
"4ae663b2ee389c0de147c509d8f18f5052afc4aaf9699efe8cb05ece883d3a5e", "4ae663b2ee389c0de147c509d8f18f5052afc4aaf9699efe8cb05ece883d3a5e",
"4ae664d503fd4cff50cfc1fb8fc606580f87b0fcdac9554ba0e01d785bdf278e", "4ae664d503fd4cff50cfc1fb8fc606580f87b0fcdac9554ba0e01d785bdf278e",
......
...@@ -221,39 +221,39 @@ func (n Name) toRDNSequence() (ret rdnSequence) { ...@@ -221,39 +221,39 @@ func (n Name) toRDNSequence() (ret rdnSequence) {
ret = make([]relativeDistinguishedNameSET, 9 /* maximum number of elements */ ) ret = make([]relativeDistinguishedNameSET, 9 /* maximum number of elements */ )
i := 0 i := 0
if len(n.Country) > 0 { if len(n.Country) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidCountry, n.Country}} ret[i] = []attributeTypeAndValue{{oidCountry, n.Country}}
i++ i++
} }
if len(n.Organization) > 0 { if len(n.Organization) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidOrganization, n.Organization}} ret[i] = []attributeTypeAndValue{{oidOrganization, n.Organization}}
i++ i++
} }
if len(n.OrganizationalUnit) > 0 { if len(n.OrganizationalUnit) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidOrganizationalUnit, n.OrganizationalUnit}} ret[i] = []attributeTypeAndValue{{oidOrganizationalUnit, n.OrganizationalUnit}}
i++ i++
} }
if len(n.CommonName) > 0 { if len(n.CommonName) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidCommonName, n.CommonName}} ret[i] = []attributeTypeAndValue{{oidCommonName, n.CommonName}}
i++ i++
} }
if len(n.SerialNumber) > 0 { if len(n.SerialNumber) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidSerialNumber, n.SerialNumber}} ret[i] = []attributeTypeAndValue{{oidSerialNumber, n.SerialNumber}}
i++ i++
} }
if len(n.Locality) > 0 { if len(n.Locality) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidLocatity, n.Locality}} ret[i] = []attributeTypeAndValue{{oidLocatity, n.Locality}}
i++ i++
} }
if len(n.Province) > 0 { if len(n.Province) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidProvince, n.Province}} ret[i] = []attributeTypeAndValue{{oidProvince, n.Province}}
i++ i++
} }
if len(n.StreetAddress) > 0 { if len(n.StreetAddress) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidStreetAddress, n.StreetAddress}} ret[i] = []attributeTypeAndValue{{oidStreetAddress, n.StreetAddress}}
i++ i++
} }
if len(n.PostalCode) > 0 { if len(n.PostalCode) > 0 {
ret[i] = []attributeTypeAndValue{attributeTypeAndValue{oidPostalCode, n.PostalCode}} ret[i] = []attributeTypeAndValue{{oidPostalCode, n.PostalCode}}
i++ i++
} }
......
...@@ -59,16 +59,16 @@ type matchHostnamesTest struct { ...@@ -59,16 +59,16 @@ type matchHostnamesTest struct {
} }
var matchHostnamesTests = []matchHostnamesTest{ var matchHostnamesTests = []matchHostnamesTest{
matchHostnamesTest{"a.b.c", "a.b.c", true}, {"a.b.c", "a.b.c", true},
matchHostnamesTest{"a.b.c", "b.b.c", false}, {"a.b.c", "b.b.c", false},
matchHostnamesTest{"", "b.b.c", false}, {"", "b.b.c", false},
matchHostnamesTest{"a.b.c", "", false}, {"a.b.c", "", false},
matchHostnamesTest{"example.com", "example.com", true}, {"example.com", "example.com", true},
matchHostnamesTest{"example.com", "www.example.com", false}, {"example.com", "www.example.com", false},
matchHostnamesTest{"*.example.com", "www.example.com", true}, {"*.example.com", "www.example.com", true},
matchHostnamesTest{"*.example.com", "xyz.www.example.com", false}, {"*.example.com", "xyz.www.example.com", false},
matchHostnamesTest{"*.*.example.com", "xyz.www.example.com", true}, {"*.*.example.com", "xyz.www.example.com", true},
matchHostnamesTest{"*.www.*.com", "xyz.www.example.com", true}, {"*.www.*.com", "xyz.www.example.com", true},
} }
func TestMatchHostnames(t *testing.T) { func TestMatchHostnames(t *testing.T) {
......
...@@ -132,54 +132,54 @@ type CryptTest struct { ...@@ -132,54 +132,54 @@ type CryptTest struct {
var CryptTests = []CryptTest{ var CryptTests = []CryptTest{
// These were sourced from http://www.freemedialibrary.com/index.php/XTEA_test_vectors // These were sourced from http://www.freemedialibrary.com/index.php/XTEA_test_vectors
CryptTest{ {
[]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
[]byte{0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, []byte{0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48},
[]byte{0x49, 0x7d, 0xf3, 0xd0, 0x72, 0x61, 0x2c, 0xb5}, []byte{0x49, 0x7d, 0xf3, 0xd0, 0x72, 0x61, 0x2c, 0xb5},
}, },
CryptTest{ {
[]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
[]byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}, []byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
[]byte{0xe7, 0x8f, 0x2d, 0x13, 0x74, 0x43, 0x41, 0xd8}, []byte{0xe7, 0x8f, 0x2d, 0x13, 0x74, 0x43, 0x41, 0xd8},
}, },
CryptTest{ {
[]byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
[]byte{0x5a, 0x5b, 0x6e, 0x27, 0x89, 0x48, 0xd7, 0x7f}, []byte{0x5a, 0x5b, 0x6e, 0x27, 0x89, 0x48, 0xd7, 0x7f},
[]byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}, []byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
}, },
CryptTest{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, []byte{0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48},
[]byte{0xa0, 0x39, 0x05, 0x89, 0xf8, 0xb8, 0xef, 0xa5}, []byte{0xa0, 0x39, 0x05, 0x89, 0xf8, 0xb8, 0xef, 0xa5},
}, },
CryptTest{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}, []byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
[]byte{0xed, 0x23, 0x37, 0x5a, 0x82, 0x1a, 0x8c, 0x2d}, []byte{0xed, 0x23, 0x37, 0x5a, 0x82, 0x1a, 0x8c, 0x2d},
}, },
CryptTest{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x70, 0xe1, 0x22, 0x5d, 0x6e, 0x4e, 0x76, 0x55}, []byte{0x70, 0xe1, 0x22, 0x5d, 0x6e, 0x4e, 0x76, 0x55},
[]byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41}, []byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
}, },
// These vectors are from http://wiki.secondlife.com/wiki/XTEA_Strong_Encryption_Implementation#Bouncy_Castle_C.23_API // These vectors are from http://wiki.secondlife.com/wiki/XTEA_Strong_Encryption_Implementation#Bouncy_Castle_C.23_API
CryptTest{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0xDE, 0xE9, 0xD4, 0xD8, 0xF7, 0x13, 0x1E, 0xD9}, []byte{0xDE, 0xE9, 0xD4, 0xD8, 0xF7, 0x13, 0x1E, 0xD9},
}, },
CryptTest{ {
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08},
[]byte{0x06, 0x5C, 0x1B, 0x89, 0x75, 0xC6, 0xA8, 0x16}, []byte{0x06, 0x5C, 0x1B, 0x89, 0x75, 0xC6, 0xA8, 0x16},
}, },
CryptTest{ {
[]byte{0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A}, []byte{0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A},
[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
[]byte{0x1F, 0xF9, 0xA0, 0x26, 0x1A, 0xC6, 0x42, 0x64}, []byte{0x1F, 0xF9, 0xA0, 0x26, 0x1A, 0xC6, 0x42, 0x64},
}, },
CryptTest{ {
[]byte{0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A}, []byte{0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9A},
[]byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}, []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08},
[]byte{0x8C, 0x67, 0x15, 0x5B, 0x2E, 0xF9, 0x1E, 0xAD}, []byte{0x8C, 0x67, 0x15, 0x5B, 0x2E, 0xF9, 0x1E, 0xAD},
......
This diff is collapsed.
...@@ -15,28 +15,28 @@ type nameTest struct { ...@@ -15,28 +15,28 @@ type nameTest struct {
} }
var nameTests = []nameTest{ var nameTests = []nameTest{
nameTest{ELFOSABI_LINUX, "ELFOSABI_LINUX"}, {ELFOSABI_LINUX, "ELFOSABI_LINUX"},
nameTest{ET_EXEC, "ET_EXEC"}, {ET_EXEC, "ET_EXEC"},
nameTest{EM_860, "EM_860"}, {EM_860, "EM_860"},
nameTest{SHN_LOPROC, "SHN_LOPROC"}, {SHN_LOPROC, "SHN_LOPROC"},
nameTest{SHT_PROGBITS, "SHT_PROGBITS"}, {SHT_PROGBITS, "SHT_PROGBITS"},
nameTest{SHF_MERGE + SHF_TLS, "SHF_MERGE+SHF_TLS"}, {SHF_MERGE + SHF_TLS, "SHF_MERGE+SHF_TLS"},
nameTest{PT_LOAD, "PT_LOAD"}, {PT_LOAD, "PT_LOAD"},
nameTest{PF_W + PF_R + 0x50, "PF_W+PF_R+0x50"}, {PF_W + PF_R + 0x50, "PF_W+PF_R+0x50"},
nameTest{DT_SYMBOLIC, "DT_SYMBOLIC"}, {DT_SYMBOLIC, "DT_SYMBOLIC"},
nameTest{DF_BIND_NOW, "DF_BIND_NOW"}, {DF_BIND_NOW, "DF_BIND_NOW"},
nameTest{NT_FPREGSET, "NT_FPREGSET"}, {NT_FPREGSET, "NT_FPREGSET"},
nameTest{STB_GLOBAL, "STB_GLOBAL"}, {STB_GLOBAL, "STB_GLOBAL"},
nameTest{STT_COMMON, "STT_COMMON"}, {STT_COMMON, "STT_COMMON"},
nameTest{STV_HIDDEN, "STV_HIDDEN"}, {STV_HIDDEN, "STV_HIDDEN"},
nameTest{R_X86_64_PC32, "R_X86_64_PC32"}, {R_X86_64_PC32, "R_X86_64_PC32"},
nameTest{R_ALPHA_OP_PUSH, "R_ALPHA_OP_PUSH"}, {R_ALPHA_OP_PUSH, "R_ALPHA_OP_PUSH"},
nameTest{R_ARM_THM_ABS5, "R_ARM_THM_ABS5"}, {R_ARM_THM_ABS5, "R_ARM_THM_ABS5"},
nameTest{R_386_GOT32, "R_386_GOT32"}, {R_386_GOT32, "R_386_GOT32"},
nameTest{R_PPC_GOT16_HI, "R_PPC_GOT16_HI"}, {R_PPC_GOT16_HI, "R_PPC_GOT16_HI"},
nameTest{R_SPARC_GOT22, "R_SPARC_GOT22"}, {R_SPARC_GOT22, "R_SPARC_GOT22"},
nameTest{ET_LOOS + 5, "ET_LOOS+5"}, {ET_LOOS + 5, "ET_LOOS+5"},
nameTest{ProgFlag(0x50), "0x50"}, {ProgFlag(0x50), "0x50"},
} }
func TestNames(t *testing.T) { func TestNames(t *testing.T) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -17,7 +17,7 @@ type testpair struct { ...@@ -17,7 +17,7 @@ type testpair struct {
var pairs = []testpair{ var pairs = []testpair{
// Wikipedia example // Wikipedia example
testpair{ {
"Man is distinguished, not only by his reason, but by this singular passion from " + "Man is distinguished, not only by his reason, but by this singular passion from " +
"other animals, which is a lust of the mind, that by a perseverance of delight in " + "other animals, which is a lust of the mind, that by a perseverance of delight in " +
"the continued and indefatigable generation of knowledge, exceeds the short " + "the continued and indefatigable generation of knowledge, exceeds the short " +
...@@ -138,8 +138,8 @@ func TestDecodeCorrupt(t *testing.T) { ...@@ -138,8 +138,8 @@ func TestDecodeCorrupt(t *testing.T) {
p int p int
} }
examples := []corrupt{ examples := []corrupt{
corrupt{"v", 0}, {"v", 0},
corrupt{"!z!!!!!!!!!", 1}, {"!z!!!!!!!!!", 1},
} }
for _, e := range examples { for _, e := range examples {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment