From: Sergey Matveev Date: Sun, 9 Jun 2019 11:27:19 +0000 (+0300) Subject: Long lines formatting X-Git-Tag: 3.0~18 X-Git-Url: http://www.git.cypherpunks.ru/?p=gogost.git;a=commitdiff_plain;h=9e61c088683b524e084c35069110ffe62039a558 Long lines formatting --- diff --git a/src/cypherpunks.ru/gogost/internal/gost34112012/hmac_test.go b/src/cypherpunks.ru/gogost/internal/gost34112012/hmac_test.go index 61b8740..ea806d5 100644 --- a/src/cypherpunks.ru/gogost/internal/gost34112012/hmac_test.go +++ b/src/cypherpunks.ru/gogost/internal/gost34112012/hmac_test.go @@ -34,15 +34,45 @@ func hash512() hash.Hash { // HMAC test vectors taken from // http://tc26.ru/methods/recommendation/%D0%A2%D0%9A26%D0%90%D0%9B%D0%93.pdf test vectors func TestHMACVectors(t *testing.T) { - h := hmac.New(hash256, []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}) - h.Write([]byte{0x01, 0x26, 0xbd, 0xb8, 0x78, 0x00, 0xaf, 0x21, 0x43, 0x41, 0x45, 0x65, 0x63, 0x78, 0x01, 0x00}) - if bytes.Compare(h.Sum(nil), []byte{0xa1, 0xaa, 0x5f, 0x7d, 0xe4, 0x02, 0xd7, 0xb3, 0xd3, 0x23, 0xf2, 0x99, 0x1c, 0x8d, 0x45, 0x34, 0x01, 0x31, 0x37, 0x01, 0x0a, 0x83, 0x75, 0x4f, 0xd0, 0xaf, 0x6d, 0x7c, 0xd4, 0x92, 0x2e, 0xd9}) != 0 { + h := hmac.New(hash256, []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, + }) + h.Write([]byte{ + 0x01, 0x26, 0xbd, 0xb8, 0x78, 0x00, 0xaf, 0x21, + 0x43, 0x41, 0x45, 0x65, 0x63, 0x78, 0x01, 0x00, + }) + if bytes.Compare(h.Sum(nil), []byte{ + 0xa1, 0xaa, 0x5f, 0x7d, 0xe4, 0x02, 0xd7, 0xb3, + 0xd3, 0x23, 0xf2, 0x99, 0x1c, 0x8d, 0x45, 0x34, + 0x01, 0x31, 0x37, 0x01, 0x0a, 0x83, 0x75, 0x4f, + 0xd0, 0xaf, 0x6d, 0x7c, 0xd4, 0x92, 0x2e, 0xd9, + }) != 0 { t.Fail() } - h = hmac.New(hash512, []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}) - h.Write([]byte{0x01, 0x26, 0xbd, 0xb8, 0x78, 0x00, 0xaf, 0x21, 0x43, 0x41, 0x45, 0x65, 0x63, 0x78, 0x01, 0x00}) - if bytes.Compare(h.Sum(nil), []byte{0xa5, 0x9b, 0xab, 0x22, 0xec, 0xae, 0x19, 0xc6, 0x5f, 0xbd, 0xe6, 0xe5, 0xf4, 0xe9, 0xf5, 0xd8, 0x54, 0x9d, 0x31, 0xf0, 0x37, 0xf9, 0xdf, 0x9b, 0x90, 0x55, 0x00, 0xe1, 0x71, 0x92, 0x3a, 0x77, 0x3d, 0x5f, 0x15, 0x30, 0xf2, 0xed, 0x7e, 0x96, 0x4c, 0xb2, 0xee, 0xdc, 0x29, 0xe9, 0xad, 0x2f, 0x3a, 0xfe, 0x93, 0xb2, 0x81, 0x4f, 0x79, 0xf5, 0x00, 0x0f, 0xfc, 0x03, 0x66, 0xc2, 0x51, 0xe6}) != 0 { + h = hmac.New(hash512, []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, + }) + h.Write([]byte{ + 0x01, 0x26, 0xbd, 0xb8, 0x78, 0x00, 0xaf, 0x21, + 0x43, 0x41, 0x45, 0x65, 0x63, 0x78, 0x01, 0x00, + }) + if bytes.Compare(h.Sum(nil), []byte{ + 0xa5, 0x9b, 0xab, 0x22, 0xec, 0xae, 0x19, 0xc6, + 0x5f, 0xbd, 0xe6, 0xe5, 0xf4, 0xe9, 0xf5, 0xd8, + 0x54, 0x9d, 0x31, 0xf0, 0x37, 0xf9, 0xdf, 0x9b, + 0x90, 0x55, 0x00, 0xe1, 0x71, 0x92, 0x3a, 0x77, + 0x3d, 0x5f, 0x15, 0x30, 0xf2, 0xed, 0x7e, 0x96, + 0x4c, 0xb2, 0xee, 0xdc, 0x29, 0xe9, 0xad, 0x2f, + 0x3a, 0xfe, 0x93, 0xb2, 0x81, 0x4f, 0x79, 0xf5, + 0x00, 0x0f, 0xfc, 0x03, 0x66, 0xc2, 0x51, 0xe6, + }) != 0 { t.Fail() } }