X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgogost%2Finternal%2Fgost34112012%2Fhash_test.go;h=903e60fa17a652f8891c92221e8fed6720c9b64d;hb=e62453143a063672586d0361f013211c73314b49;hp=e7422d7db97e014adbf8350a29a86d19991b4ab7;hpb=8edf448e15d2569ddd31a124f89075e7617aad09;p=gogost.git 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) {