Commits

Eric Roshan Eisner committed dc6c500 Draft

full testsuite

Comments (0)

Files changed (1)

 import (
 	"fmt"
 	"hash"
+	"io"
 	"testing"
 )
 
-var golden256 = []struct {
-	d string
-	m string
-}{
-	{"c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", ""},
+type testCase struct {
+	out, in string
 }
 
-func stressTest(t *testing.T, f func() hash.Hash, message, hexdigest string) {
-	h := f()
-	sum := make([]byte, h.Size())
-	want := hexdigest
+var golden224 = []testCase{
+	{"f71837502ba8e10837bdd8d365adb85591895602fc552b48b7390abd", ""},
+	{"7cf87d912ee7088d30ec23f8e7100d9319bff090618b439d3fe91308", "a"},
+	{"54927ada38dd4928ba3bc8d40059dbe1ba68ed7f8e3a6fb3b41492f3", "ab"},
+	{"c30411768506ebe1c2871b1ee2e87d38df342317300a9b97a95ec6a8", "abc"},
+	{"be2ec6c1cce305a0ba88300bfcad0ab0b9f480f964be34b2cd253199", "abcd"},
+	{"16f91f7e036df526340440c34c231862d8f6319772b670eefd4703ff", "abcde"},
+	{"f25562c4558a6960223c65478722d0116c74ea8ff1e4dbfd6e2f78ec", "abcdef"},
+	{"7421c4ed02c1094b979aa20dfd4636b45f6446e9df281be6597a3228", "abcdefg"},
+	{"6b1f16d8ad4d5f51fe46d837480011df14fa2864a89dc887ee3d7134", "abcdefgh"},
+	{"0896c1ec34b0c9ea02adc54e7b994243806ec211958b7be3f1742c50", "abcdefghi"},
+	{"61a295a661305e3b50f096bc32625ed48aac1110226e9c6d360e0415", "abcdefghij"},
+	{"28ba63adf4bfb160aaa256e5d09db8c8347c340e1977845bc5c55ac4", "Discard medicine more than two years old."},
+	{"207e32ad87be220817d73e7e5ef686c00a031a538d4ac5d5fd44b2c7", "He who has a shady past knows that nice guys finish last."},
+	{"557fa455eea745283cf52641a9a0bd9d0c330b945f96b5512c20970e", "I wouldn't marry him with a ten foot pole."},
+	{"4bbe1d6e66646d1826a8de388a77365de008d35480c922cc4b4d8be9", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"},
+	{"a0f7400d64f1d0c3c1065ca000ef76d2c3d49af0d6bebd97a07fa9bb", "The days of the digital watch are numbered.  -Tom Stoppard"},
+	{"2d84f95b60d2cd3358c54eae5856c6d381ef364bdf8f8090d1bc2be5", "Nepal premier won't resign."},
+	{"78294b5840e84d749cbd8fa3eeff4cbc4a4365cb6d641ea044b75b69", "For every action there is an equal and opposite government program."},
+	{"35cc555990f1d76c7e56070f40ca2b765fa205e1777055ed32d36d34", "His money is twice tainted: 'taint yours and 'taint mine."},
+	{"6545a370a07c8ba34fc72d0526f750cb63661ae4d6bc1ba57c7bd2c8", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"},
+	{"95ff7374750fb53db8af5b293c262b9fe8eb7d7b6114411cb36c3b97", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"},
+	{"90bf8837ce11c1ad4e682a5594057458e1a5ae10a892292ffa236087", "size:  a.out:  bad magic"},
+	{"6ed7f89fa3011b252abb5a806e768e80f62db68e8843b6750971c0ec", "The major problem is with sendmail.  -Mark Horton"},
+	{"4339520064547cf9a95f11424ff0c1b9c1388b561a2e5e78cd7edcf0", "Give me a rock, paper and scissors and I will move the world.  CCFestoon"},
+	{"f82770d043da1db17062dd82f55fb59024e3c2e45b5f6fc773958ddb", "If the enemy is within range, then so are you."},
+	{"d52cf245fd595a772afe5eda90169ef1cd979042e4cada3f8ee2c215", "It's well we cannot hear the screams/That we create in others' dreams."},
+	{"c17d658bf1df3237e198d9cdbea8d9b81e1514a1be244275f99c79fd", "You remind me of a TV show, but that's all right: I watch it anyway."},
+	{"12a5099e80a95163a841d444dfa4bbfab81dc5deb2297829ab7dd427", "C is as portable as Stonehedge!!"},
+	{"05b78ef900e46c6e6ddd4c182318497588d77eb1ad309ddcd0242e84", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"},
+	{"1478c49191fabfb9d25a11cc216288b1c0df0c11b2c7f26e935c8de9", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction.  Lewis-Randall Rule"},
+	{"8e1b3037640804d6aa0f7282d69d1dfac5c3fbcea43e093620d00f6e", "How can you write a big system without C++?  -Paul Glick"},
+}
 
-	check := func() {
-		h.Sum(sum[:0])
-		got := fmt.Sprintf("%x", sum)
-		if got != want {
-			t.Errorf("sha3(%q) got %s want %s\n", message, got, want)
+var golden256 = []testCase{
+	{"c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", ""},
+	{"3ac225168df54212a25c1c01fd35bebfea408fdac2e31ddd6f80a4bbf9a5f1cb", "a"},
+	{"67fad3bfa1e0321bd021ca805ce14876e50acac8ca8532eda8cbf924da565160", "ab"},
+	{"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45", "abc"},
+	{"48bed44d1bcd124a28c27f343a817e5f5243190d3c52bf347daf876de1dbbf77", "abcd"},
+	{"6377c7e66081cb65e473c1b95db5195a27d04a7108b468890224bedbe1a8a6eb", "abcde"},
+	{"acd0c377fe36d5b209125185bc3ac41155ed1bf7103ef9f0c2aff4320460b6df", "abcdef"},
+	{"a82aec019867b7307551dc397acde18b541e742fa1a4e53df4ce3b02d462f524", "abcdefg"},
+	{"48624fa43c68d5c552855a4e2919e74645f683f5384f72b5b051b71ea41d4f2d", "abcdefgh"},
+	{"34fb2702da7001bf4dbf26a1e4cf31044bd95b85e1017596ee2d23aedc90498b", "abcdefghi"},
+	{"f8da54b5a7dd75028acb077ee61e8dde47ed37c746703ce764edf4a789eb2103", "abcdefghij"},
+	{"f02f7bafef53c09bd71f5d0a22c267a1b01a543aa5f4be05f0d88ea683a37266", "Discard medicine more than two years old."},
+	{"3719a0b0b1e95b14dd0274fcd2eb8ac3cb0b9af8c032b767821b3fef036d2717", "He who has a shady past knows that nice guys finish last."},
+	{"f1ef9acd04c321aa8122bb8c5cf812776dcfa33e18fbb0cc52c6c6f35f2757a8", "I wouldn't marry him with a ten foot pole."},
+	{"35edd2014775f9fe8da3f8567a478f39daa861c1350ddedb2f61e05b733a976d", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"},
+	{"f3e52fda127a4fe928d125559124b806b83d5f843a9f999a23f0cfb9fc515b39", "The days of the digital watch are numbered.  -Tom Stoppard"},
+	{"0f39c9f917bf8536fb109557db30179d6226e510d4abd9a74ca99ae1a2ad752b", "Nepal premier won't resign."},
+	{"7d335a1aa35a4ac3ae7ea4992f600859c20360f6b056344b1837d53ad5fa45b0", "For every action there is an equal and opposite government program."},
+	{"1aca6f37f0482f98a41a758455f48ec5fdc979c9bec3aeafebc8137ed36871ea", "His money is twice tainted: 'taint yours and 'taint mine."},
+	{"97eafbd4d117620989ccd6a125cd59077e214033fa34639bff0bada4967bb9c6", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"},
+	{"b223e44f2a28d78fa8a98b29f84457600c64f0426bbee27e53745c775a448d67", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"},
+	{"102ef8cde52813c1bd531729f64706209b06c06debab4bbe68c00b47e9c4faeb", "size:  a.out:  bad magic"},
+	{"2ad8ce486b4bdf78b0cd69b6275cab1aea91d338da3a88c2e7285794ae82fef6", "The major problem is with sendmail.  -Mark Horton"},
+	{"d8d4dd4bd56961d9f7d0587a8dd1538ff8da3682997a3b00101f81538de2598c", "Give me a rock, paper and scissors and I will move the world.  CCFestoon"},
+	{"ae7e9bc6208622e7ec9e4a33587c448b3bed80d7dfea9689f6c2b150f24be21e", "If the enemy is within range, then so are you."},
+	{"a3a4926a0efe719e818a336253bfbc8751fbd1ca6affcdad57d48ba928af6f1d", "It's well we cannot hear the screams/That we create in others' dreams."},
+	{"8139c3fe5fd03dfbbaf03cba4c2849ebd72907d3d8f5d69cec94a5bf119c98c4", "You remind me of a TV show, but that's all right: I watch it anyway."},
+	{"6aed27f23f905b041ce678357b6719515e050e6b991320e7de2099b1afd3e1c8", "C is as portable as Stonehedge!!"},
+	{"db5196399f418fac315f6339c482abb0390ea56616d5e3bc643621b60e194753", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"},
+	{"0a2b2e10ffb7ddd78e025a7bbe28fdfc320c76ad7dbc8c429217e2b5cde8577c", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction.  Lewis-Randall Rule"},
+	{"231c9e570dc845439f968b2db1d89cf33c0128d36c0342e93fad2817f53a8ac4", "How can you write a big system without C++?  -Paul Glick"},
+}
+
+var golden384 = []testCase{
+	{"2c23146a63a29acf99e73b88f8c24eaa7dc60aa771780ccc006afbfa8fe2479b2dd2b21362337441ac12b515911957ff", ""},
+	{"85e964c0843a7ee32e6b5889d50e130e6485cffc826a30167d1dc2b3a0cc79cba303501a1eeaba39915f13baab5abacf", "a"},
+	{"d1112a0665627802eb0ff3225564b9cf6e99e1d58867a093095d16894e868549091d37e109da5c3bd671b39625e73591", "ab"},
+	{"f7df1165f033337be098e7d288ad6a2f74409d7a60b49c36642218de161b1f99f8c681e4afaf31a34db29fb763e3c28e", "abc"},
+	{"565c4034428749960ad82523596b0bb422986c1941463ce4678e81391c6eb3e47be5d85b9394217dc7d25dda8328f392", "abcd"},
+	{"6e577a02a783232acf34841399883f5f69d9ac78f48c7f4431cbc4f669c2a0f1ca3b1becb7701b8315588d64d6c3746a", "abcde"},
+	{"74d37ca559e56227d8cac623cf2b1913abf69dab39ebfe04bb3dd50268462e1439ad5b5c5645ddcdff32e8d5f79d8281", "abcdef"},
+	{"797766a1dc38e3b027ae3511d56792c2b044005659a1248c46da8af462ed79ccef2854c033cc82f75d673c92514d963b", "abcdefg"},
+	{"3f57fa1fe45b9dbfdd3c0e07fe5807c2c70ee6935bd35b2cf35750b52b15bdbbde372d8c4aee50013326fec4d86af805", "abcdefgh"},
+	{"7022f23e60b3c13688d206838333b317132e1fd2acf1ee6dea22c4f4416d01422483fe629486db47010b29560f59cf49", "abcdefghi"},
+	{"71b8f2a7d9ba34642ca22a71d6a657fb91e4102ebc9400225901f51749a339681dc54937e1d1b081919a525974d1a479", "abcdefghij"},
+	{"370017ee357f732494392ef13020d246111c469f77bb5ce9a4d0cc931adb226b6826826f7de57703092b5d9eacf75622", "Discard medicine more than two years old."},
+	{"74393855afaecf794f8eb9dea5496a66b559b44fdd35cbab7b08e39a7396c6295f6fe011957b769df40fe0c16b72bcb9", "He who has a shady past knows that nice guys finish last."},
+	{"629a609c09915d50836a7d0ad6e7c4f76ee04b425e65863956a8a8e7f2b509a47666e6a1c826953275034bd3769c18ee", "I wouldn't marry him with a ten foot pole."},
+	{"cc2fbd300dbb584d1066b429cde405c1c779a94da63090bc780c245a056aa23297ca8d83d21281235674145a08e86d8d", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"},
+	{"a8fac8c6f3e585b00785826397e6bc7b1f116af20f21931c159a8f87b2fffa61066672953390d985604b1b6d6b9848a8", "The days of the digital watch are numbered.  -Tom Stoppard"},
+	{"370df39738c69e36fae7638968da9988199d49a807ed90bf9541f00a7f09da8bf10400935a053dfaac3394ed96f90a52", "Nepal premier won't resign."},
+	{"47c832a22823d0387f1c7ffdc875c82340565aaa460987ac6235243e1add44fed089766af5f42b471979b1219584b3e0", "For every action there is an equal and opposite government program."},
+	{"682bfb8bec7577597de0ca60382b00c23a4721a1506680be7bd2be48f7577826d208125378766c9a611057401ef4cc31", "His money is twice tainted: 'taint yours and 'taint mine."},
+	{"e1f4ce7a3174c9e7a3f246a5bd20c8275a60318f9a138fa6d7d681d826cf48c3deb8e51a5d2da871ee827ab515b42328", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"},
+	{"b7eadb66dd83ec56ca146954f2868bc67c4aed6fdac108ed625d6061d6964471446fdcc20abf06200034d1fd7e90c800", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"},
+	{"6a40c67941c6195e99b168ad79d8d87c590e3123932a97fb7aadd97a1a0080a8bbdd45933e86beb3bde48e161adcee0c", "size:  a.out:  bad magic"},
+	{"fdeb6add08ae3ee376fd793ddd7a9e47444ace59e0fb27a10acba55a1ab2915d3ad4e82e17eef9f2c7feae2af427d07c", "The major problem is with sendmail.  -Mark Horton"},
+	{"ee1fb170d1b31c87afc4aa4089e616363ad36f87d33e20d2cca43b8daa34380f1fa9bc392554f7be0c11e5fdf341c99a", "Give me a rock, paper and scissors and I will move the world.  CCFestoon"},
+	{"8f36e2b4f615c3fdacb3d4078463f7b3cb06ab20ca1f5b44fd014ecba8396e02d288bfcb3d4a86e04242a907eb00066e", "If the enemy is within range, then so are you."},
+	{"5f3a5981262c2ad250b7d06b3f7c1bf13edb05a2309371abaafcf06015b7cc367f5bbe68c40f4c09ff809dd68ca6b585", "It's well we cannot hear the screams/That we create in others' dreams."},
+	{"f9592d2396bd7d4d7dbef41e74d3cd335a697e1c86c702a1d16208c86a586db0ee50078560be51247648f619bbf266af", "You remind me of a TV show, but that's all right: I watch it anyway."},
+	{"246ea1cefe4203997f57715f6376e25d5456b38d0976d745fc7ae971aa1cf956395d31a297bfb21f6b5f0a6ceb3bb57d", "C is as portable as Stonehedge!!"},
+	{"31ecff0a09b309aaaa8e02a4b8c54a01504d0045efd7b33e10dba13da48fb20491447c6f4d7c5ffb6766c3644acde552", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"},
+	{"d1ff406f387c8b78b928869e3c19ddea5da4c0a71a5bc555f4b6f4810d071deda2aeb2ac4eb41a3d25a4200693ca1d5f", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction.  Lewis-Randall Rule"},
+	{"d3ab14ec76d8ce941e46800c2ac7a9da00fe4d275b0d4dd9d2bbbf38b1208cec38b4f039366f66c6dd60dd4b67af0e6e", "How can you write a big system without C++?  -Paul Glick"},
+}
+
+var golden512 = []testCase{
+	{"0eab42de4c3ceb9235fc91acffe746b29c29a8c366b7c60e4e67c466f36a4304c00fa9caf9d87976ba469bcbe06713b435f091ef2769fb160cdab33d3670680e", ""},
+	{"9c46dbec5d03f74352cc4a4da354b4e9796887eeb66ac292617692e765dbe400352559b16229f97b27614b51dbfbbb14613f2c10350435a8feaf53f73ba01c7c", "a"},
+	{"b4828cc4e3fe9e5bc17013579be02b2a900c7afd7084c1f29450fcb267dcf1bc4def62a2cbefda507735547c203a3699f8a0d972fd13139dd73af0a3c30501e7", "ab"},
+	{"18587dc2ea106b9a1563e32b3312421ca164c7f1f07bc922a9c83d77cea3a1e5d0c69910739025372dc14ac9642629379540c17e2a65b19d77aa511a9d00bb96", "abc"},
+	{"e4a7e8f5572f4853ef26a862f31687c249b1cd7922df2aac1f4348d8ceef944c74d1949e3465704a5f3f89fb53e0dcce3ea142c90af04c84cc7e548f144f8f0b", "abcd"},
+	{"37491bd4bf2a4629d4e35602e09812fa94bfc63baee4487075e2b6d73f36d01a7392a1719edbbb5d1d6fa3ba0d144f18229abc13b7933a4736d6aab4a3177f18", "abcde"},
+	{"86e0c78ab53dd68c9285dc186e24c5dd59788850c3a07a7f39e5dac4ec80c3c78ddfbc40ff5eeae11661d9b1043573e82767e1080055c7747bc0e8fb8af7a3e1", "abcdef"},
+	{"c11cb6ae7a1173e659b9ea9a39ee269e7f92f0e2b313323b0ef31d6ab557c221c000fa7e492290de71fdfad2f58dcc30573e1366dec358eee1ca8102fb583500", "abcdefg"},
+	{"c96950698dd2e6e2051637687d676a64bf7170908d69004cab008fb4d5d25d780be1e0ca503f947f07859dd477249787705ef813b64abb6477a22aa1fb908d1d", "abcdefgh"},
+	{"439e659366d06d55bb7ba2b4c6fd6f07556b84996cad815b1ba2af5d9ec432ca06bebf7cec2d2dd6a481d345825477edf62b93f5235d613ecfa975271631e083", "abcdefghi"},
+	{"8ebc5886e18e8c759f34fc89502496cd6a27ca923f957765618d5e0767f170ba30e48497cb11f5fd92c24e93d273f1bbb287de9d764096d64996fd35271a17db", "abcdefghij"},
+	{"486ed4e391cf9d6459c218d09c1ec65700a652803215cff09196804eecfdf45f6792bd967bff57563e9cca60a604519c21d68aa1dfcca6b1539adc04c0a9541f", "Discard medicine more than two years old."},
+	{"52e3d4880843c7242ed1e3849a0639b418a094886a069c05f5731cea244ca515b92be5e6da5a7fb15fa2f37fb0c316dc2de3bb101bb86134ea2d438bc2522f11", "He who has a shady past knows that nice guys finish last."},
+	{"911b572817a5c82e835e862ef1442decb1250b1ae464a12886f6e5c54053e4c44b121736b06207d38859d276fd68d398fdc1e2c968450981566371f4a700506a", "I wouldn't marry him with a ten foot pole."},
+	{"a14cf2c3943da054724e09f468b8decfe9e0d420868aafe948d05537fcbbccb97fe9dd22e4d6c94603fecc452ee326168c0d8bb806622026388f32577abaad16", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"},
+	{"924c6b413a93a70fe26a20766ff32ccd7cc2a72ca0d2c5170dd3092b40831a76203023e7a632beaa2c48d2072b22dd62e5c1629f36a21733d151f59952f339df", "The days of the digital watch are numbered.  -Tom Stoppard"},
+	{"20d62981d51d9b2a62bc443044ffe1d5563f6d064bf86bead36b21b91148928a97f2d5b312c8b01c093ac3e97acdf7f99806df31c5572c5fec879b801cf6f504", "Nepal premier won't resign."},
+	{"146fd191470373cc5fe0ea7a08128261a9c45403db37b29e4186b3ae394d24d942d18e700daf9326ef248cfe99bdd4d4e31af71ea4ae8295a5a550cf7301e900", "For every action there is an equal and opposite government program."},
+	{"39f92a1338eb59d8e614dc19639910689c8f0e7c69914a852d2cffd7293b265533f9976e8c46e9276d121aa53d4e44f6324a9bfbc62c7184656def7ca452487a", "His money is twice tainted: 'taint yours and 'taint mine."},
+	{"69147d562da65b637981ee451c9e5f2a8be81826132be2ae36f17d8fed15a8217a1f1ec9e88a289109e956f48f74435289f1b1ecd3461126dd1c8b6b6b263d4c", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"},
+	{"c7801532131406affb7b5680fd85612b3fd7c2bbc126c4b424f79e0ffbd6270eb42c8816ff554a863c80e614e090abf886a279ecbe035e061364680af5653dc2", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"},
+	{"ed377912ce2f88fd010b7c3917a64233a4a7d073d52ad2a887355ec8d09cfeccc7f85a72b09a2ff8fc998255dc0f4f2670dc6cbf5ba9774db3a0f236044b821f", "size:  a.out:  bad magic"},
+	{"09c1341db1eabfd9a97ff48a3febb44af28f472b82003dd9dbf20ee0bbc2de333b39083f3440d9c11a5d8e92cf5c633d0cda94d9dbd90163bea73f88037a0d0a", "The major problem is with sendmail.  -Mark Horton"},
+	{"812a7faa25f216b543b6ef3e18427c6524dba15bc47d45b4f9e1d546f7383af69a9a5668ff9345bdb8eb1690dbbf669ea44802f591ddfe63c1d42f0bca79d5f4", "Give me a rock, paper and scissors and I will move the world.  CCFestoon"},
+	{"9c8a6c6943ea6ee7b4b5bd315132dec25d59974e534c3f94a6663ede655fbc8c100367c6c64b762d77099ba6dbe4629e084f4ed97c687638d6882c225d9f5567", "If the enemy is within range, then so are you."},
+	{"b99df443fee19d750b2a4f5bd9ab913249ea29bdf7725c44377e4d8e679ff8703c6347225ece45b16552f9b216dc07a3f0edd685a2673e24465e71d9e171b47d", "It's well we cannot hear the screams/That we create in others' dreams."},
+	{"62392a77fae868f76b23fc91be2ed133a325773bb7daf664a0340d50f3c322ace21f12eed3b3e5eee3f7d38e68c9198dea06151056284ae5b898489f72fb6cd9", "You remind me of a TV show, but that's all right: I watch it anyway."},
+	{"a8b2929d9ff230b526e214857fc3db7ddfaaae2f7a7352b0d31895ba2dfeb07a52a2706ee4073abc93a42d2b9ef672c004073ba55d68a13f26853a2006da0909", "C is as portable as Stonehedge!!"},
+	{"daed5b3b99799a8c7638cba7b7d28995958e8813b40652b62377af4facadf5e6032a14aa1db1780721026f6ae8fad9d4cef3f00dd3f9315d7406507ec8d43f51", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"},
+	{"3d26782c084cbb66286799a97adc071ab5547073f9116eea9dbfd5f98c9dff9dabdc2e185be6ee911c496382a9af948e8457db9f7ea61f06d6e7bb1b933a0036", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction.  Lewis-Randall Rule"},
+	{"373dba64c5997673b2084af3bd9f385781c3f246a5b0204036a9bb3db5d2bee5ba8da8179ae16d174422acbec3d626f99a6ec0871cafdfa38d782e190628adb3", "How can you write a big system without C++?  -Paul Glick"},
+}
+
+func testGolden(t *testing.T, f func() hash.Hash, golden []testCase) {
+	for _, g := range golden {
+		c := f()
+		for j := 0; j < 3; j++ {
+			if j < 2 {
+				io.WriteString(c, g.in)
+			} else {
+				io.WriteString(c, g.in[0:len(g.in)/2])
+				c.Sum(nil)
+				io.WriteString(c, g.in[len(g.in)/2:])
+			}
+			s := fmt.Sprintf("%x", c.Sum(nil))
+			if s != g.out {
+				t.Fatalf("sha3_%d[%d](%s) = %s want %s", c.Size()*8, j, g.in, s, g.out)
+			}
+			c.Reset()
 		}
-
-	}
-
-	m := []byte(message)
-	h.Write(m)
-	check()
-
-	h.Reset()
-	for i := 0; i < len(m)/2; i++ {
-		h.Write(m[:0])
-		h.Write(m[i : i+1])
-	}
-	h.Sum(sum[:0])
-	for i := len(m) / 2; i < len(m); i++ {
-		h.Write(m[:0])
-		h.Write(m[i : i+1])
-	}
-	check()
-
-	if len(m) > h.BlockSize() {
-		n := h.BlockSize()
-		h.Reset()
-		h.Write(m[:n-1])
-		h.Write(m[n-1 : n+1])
-		h.Write(m[n+1:])
-		check()
 	}
 }
 
 func TestGolden(t *testing.T) {
-	for _, tc := range golden256 {
-		stressTest(t, New256, tc.m, tc.d)
-	}
+	testGolden(t, New224, golden224)
+	testGolden(t, New256, golden256)
+	testGolden(t, New384, golden384)
+	testGolden(t, New512, golden512)
 }
 
 var bench = New256()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.