From: Sergey Matveev Date: Sun, 9 Jun 2019 09:40:14 +0000 (+0300) Subject: Habr-article 34.11-2012 test vector X-Git-Tag: 3.0~20 X-Git-Url: http://www.git.cypherpunks.ru/?p=gogost.git;a=commitdiff_plain;h=e62453143a063672586d0361f013211c73314b49 Habr-article 34.11-2012 test vector --- diff --git a/src/cypherpunks.ru/gogost/internal/gost34112012/hash_test.go b/src/cypherpunks.ru/gogost/internal/gost34112012/hash_test.go index e7422d7..903e60f 100644 --- a/src/cypherpunks.ru/gogost/internal/gost34112012/hash_test.go +++ b/src/cypherpunks.ru/gogost/internal/gost34112012/hash_test.go @@ -105,6 +105,38 @@ func TestVectors(t *testing.T) { }) != 0 { t.Fail() } + + // Test vector from https://habr.com/ru/post/450024/ + h256.Reset() + m = []byte{ + 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3e, 0x00, 0x03, 0x00, 0xfe, 0xff, 0x09, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + } + h256.Write(m) + if bytes.Compare(h256.Sum(nil), []byte{ + 0xc7, 0x66, 0x08, 0x55, 0x40, 0xca, 0xaa, 0x89, + 0x53, 0xbf, 0xcf, 0x7a, 0x1b, 0xa2, 0x20, 0x61, + 0x9c, 0xee, 0x50, 0xd6, 0x5d, 0xc2, 0x42, 0xf8, + 0x2f, 0x23, 0xba, 0x4b, 0x18, 0x0b, 0x18, 0xe0, + }) != 0 { + t.Fail() + } } func TestBlocksized(t *testing.T) {