// GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2018 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2015-2019 Sergey Matveev <stargrave@stargrave.org>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
}
// Second vector
+ // It is CP1251-encoded "Се ветри, Стрибожи внуци, веютъ с моря
+ // стрелами на храбрыя плъкы Игоревы" string
h512.Reset()
h256.Reset()
m = []byte{
}) != 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) {