ut.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. #include <library/cpp/digest/argonish/argon2.h>
  2. #include <library/cpp/digest/argonish/blake2b.h>
  3. #include <library/cpp/testing/unittest/registar.h>
  4. Y_UNIT_TEST_SUITE(ArgonishTest) {
  5. const ui8 GenKatPassword[32] = {
  6. 0x01,
  7. 0x01,
  8. 0x01,
  9. 0x01,
  10. 0x01,
  11. 0x01,
  12. 0x01,
  13. 0x01,
  14. 0x01,
  15. 0x01,
  16. 0x01,
  17. 0x01,
  18. 0x01,
  19. 0x01,
  20. 0x01,
  21. 0x01,
  22. 0x01,
  23. 0x01,
  24. 0x01,
  25. 0x01,
  26. 0x01,
  27. 0x01,
  28. 0x01,
  29. 0x01,
  30. 0x01,
  31. 0x01,
  32. 0x01,
  33. 0x01,
  34. 0x01,
  35. 0x01,
  36. 0x01,
  37. 0x01,
  38. };
  39. const ui8 GenKatSalt[16] = {
  40. 0x02,
  41. 0x02,
  42. 0x02,
  43. 0x02,
  44. 0x02,
  45. 0x02,
  46. 0x02,
  47. 0x02,
  48. 0x02,
  49. 0x02,
  50. 0x02,
  51. 0x02,
  52. 0x02,
  53. 0x02,
  54. 0x02,
  55. 0x02,
  56. };
  57. const ui8 GenKatSecret[8] = {
  58. 0x03,
  59. 0x03,
  60. 0x03,
  61. 0x03,
  62. 0x03,
  63. 0x03,
  64. 0x03,
  65. 0x03,
  66. };
  67. const ui8 GenKatAAD[12] = {
  68. 0x04,
  69. 0x04,
  70. 0x04,
  71. 0x04,
  72. 0x04,
  73. 0x04,
  74. 0x04,
  75. 0x04,
  76. 0x04,
  77. 0x04,
  78. 0x04,
  79. 0x04,
  80. };
  81. constexpr NArgonish::EInstructionSet MaxArch =
  82. #if !defined(_arm64_)
  83. NArgonish::EInstructionSet::AVX2
  84. #else
  85. NArgonish::EInstructionSet::REF
  86. #endif
  87. ;
  88. Y_UNIT_TEST(Argon2_Factory_SelfTest) {
  89. try {
  90. NArgonish::TArgon2Factory factory;
  91. } catch (...) {
  92. UNIT_FAIL("Argon2 factory self-test fail");
  93. }
  94. }
  95. Y_UNIT_TEST(Argon2d) {
  96. const ui8 TResult[32] = {
  97. 0x7b, 0xa5, 0xa1, 0x7a, 0x72, 0xf7, 0xe5, 0x99,
  98. 0x77, 0xf7, 0xf2, 0x3d, 0x10, 0xe6, 0x21, 0x89,
  99. 0x8c, 0x63, 0xce, 0xbe, 0xed, 0xda, 0xbd, 0x15,
  100. 0xd8, 0xc6, 0x8f, 0x53, 0xea, 0xb2, 0x1a, 0x32};
  101. NArgonish::TArgon2Factory factory;
  102. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  103. ui8 result[32];
  104. auto argon2d = factory.Create(
  105. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2d,
  106. 1, 32, 1, GenKatSecret, sizeof(GenKatSecret));
  107. argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  108. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  109. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  110. UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
  111. GenKatSalt, sizeof(GenKatSalt),
  112. TResult, sizeof(TResult),
  113. GenKatAAD, sizeof(GenKatAAD)));
  114. }
  115. }
  116. Y_UNIT_TEST(Argon2i) {
  117. const ui8 TResult[32] = {
  118. 0x87, 0x4d, 0x23, 0xfb, 0x9f, 0x55, 0xe2, 0xff,
  119. 0x66, 0xbc, 0x19, 0x03, 0x46, 0xe7, 0x01, 0x19,
  120. 0x7c, 0x9f, 0x25, 0xd1, 0x1d, 0xa4, 0x5a, 0xad,
  121. 0x0d, 0x5d, 0x24, 0x19, 0x8a, 0xac, 0xd2, 0xbb};
  122. NArgonish::TArgon2Factory factory;
  123. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  124. ui8 result[32];
  125. auto argon2i = factory.Create(
  126. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2i,
  127. 1, 32, 1, GenKatSecret, sizeof(GenKatSecret));
  128. argon2i->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  129. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  130. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  131. UNIT_ASSERT(argon2i->Verify(GenKatPassword, sizeof(GenKatPassword),
  132. GenKatSalt, sizeof(GenKatSalt),
  133. TResult, sizeof(TResult),
  134. GenKatAAD, sizeof(GenKatAAD)));
  135. }
  136. }
  137. Y_UNIT_TEST(Argon2id) {
  138. const ui8 TResult[32] = {
  139. 0x99, 0xdf, 0xcf, 0xc2, 0x89, 0x76, 0x93, 0x9d,
  140. 0xa2, 0x97, 0x09, 0x44, 0x34, 0xd8, 0x6f, 0xd0,
  141. 0x0c, 0x94, 0x9a, 0x0f, 0x31, 0x8c, 0x22, 0xf0,
  142. 0xcb, 0xb4, 0x69, 0xaa, 0xa8, 0x72, 0x18, 0xba};
  143. NArgonish::TArgon2Factory factory;
  144. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  145. ui8 result[32];
  146. auto argon2id = factory.Create(
  147. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2id,
  148. 1, 32, 1, GenKatSecret, sizeof(GenKatSecret));
  149. argon2id->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  150. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  151. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  152. UNIT_ASSERT(argon2id->Verify(GenKatPassword, sizeof(GenKatPassword),
  153. GenKatSalt, sizeof(GenKatSalt),
  154. TResult, sizeof(TResult),
  155. GenKatAAD, sizeof(GenKatAAD)));
  156. }
  157. }
  158. Y_UNIT_TEST(Argon2d_2p) {
  159. const ui8 TResult[32] = {
  160. 0x59, 0xb0, 0x94, 0x62, 0xcf, 0xdc, 0xd2, 0xb4,
  161. 0x0a, 0xbd, 0x17, 0x81, 0x0a, 0x47, 0x4a, 0x8e,
  162. 0xc1, 0xab, 0xb7, 0xc1, 0x8d, 0x07, 0x53, 0x7c,
  163. 0xb9, 0x64, 0xa2, 0x59, 0x3f, 0xe9, 0xd9, 0xc5};
  164. NArgonish::TArgon2Factory factory;
  165. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  166. ui8 result[32];
  167. auto argon2d = factory.Create(
  168. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2d,
  169. 2, 32, 1, GenKatSecret, sizeof(GenKatSecret));
  170. argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  171. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  172. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  173. UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
  174. GenKatSalt, sizeof(GenKatSalt),
  175. TResult, sizeof(TResult),
  176. GenKatAAD, sizeof(GenKatAAD)));
  177. }
  178. }
  179. Y_UNIT_TEST(Argon2i_2p) {
  180. const ui8 TResult[32] = {
  181. 0xc1, 0x0f, 0x00, 0x5e, 0xf8, 0x78, 0xc8, 0x07,
  182. 0x0e, 0x2c, 0xc5, 0x2f, 0x57, 0x75, 0x25, 0xc9,
  183. 0x71, 0xc7, 0x30, 0xeb, 0x00, 0x64, 0x4a, 0x4e,
  184. 0x26, 0xd0, 0x6e, 0xad, 0x75, 0x46, 0xe0, 0x44};
  185. NArgonish::TArgon2Factory factory;
  186. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  187. ui8 result[32];
  188. auto argon2i = factory.Create(
  189. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2i,
  190. 2, 32, 1, GenKatSecret, sizeof(GenKatSecret));
  191. argon2i->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  192. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  193. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  194. UNIT_ASSERT(argon2i->Verify(GenKatPassword, sizeof(GenKatPassword),
  195. GenKatSalt, sizeof(GenKatSalt),
  196. TResult, sizeof(TResult),
  197. GenKatAAD, sizeof(GenKatAAD)));
  198. }
  199. }
  200. Y_UNIT_TEST(Argon2id_2p) {
  201. const ui8 TResult[32] = {
  202. 0x6c, 0x00, 0xb7, 0xa9, 0x00, 0xe5, 0x00, 0x4c,
  203. 0x24, 0x46, 0x9e, 0xc1, 0xe7, 0xc0, 0x1a, 0x99,
  204. 0xb2, 0xb8, 0xf7, 0x73, 0x75, 0xd4, 0xec, 0xa7,
  205. 0xd8, 0x08, 0x42, 0x11, 0xd3, 0x23, 0x6b, 0x7a};
  206. NArgonish::TArgon2Factory factory;
  207. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  208. ui8 result[32];
  209. auto argon2id = factory.Create(
  210. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2id,
  211. 2, 32, 1, GenKatSecret, sizeof(GenKatSecret));
  212. argon2id->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  213. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  214. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  215. UNIT_ASSERT(argon2id->Verify(GenKatPassword, sizeof(GenKatPassword),
  216. GenKatSalt, sizeof(GenKatSalt),
  217. TResult, sizeof(TResult),
  218. GenKatAAD, sizeof(GenKatAAD)));
  219. }
  220. }
  221. Y_UNIT_TEST(Argon2d_2p_2th) {
  222. const ui8 TResult[32] = {
  223. 0x2b, 0x47, 0x35, 0x39, 0x4a, 0x40, 0x3c, 0xc9,
  224. 0x05, 0xfb, 0x51, 0x25, 0x96, 0x68, 0x64, 0x43,
  225. 0x02, 0x16, 0x38, 0xa6, 0xc1, 0x58, 0xfc, 0x8d,
  226. 0xbf, 0x35, 0x73, 0x9a, 0xdb, 0x31, 0x0c, 0x60};
  227. NArgonish::TArgon2Factory factory;
  228. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  229. ui8 result[32];
  230. auto argon2d = factory.Create(
  231. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2d,
  232. 2, 32, 2, GenKatSecret, sizeof(GenKatSecret));
  233. argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  234. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  235. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  236. UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
  237. GenKatSalt, sizeof(GenKatSalt),
  238. TResult, sizeof(TResult),
  239. GenKatAAD, sizeof(GenKatAAD)));
  240. }
  241. }
  242. Y_UNIT_TEST(Argon2id_2p_4th) {
  243. const ui8 TResult[32] = {
  244. 0x4f, 0x93, 0xb5, 0xad, 0x78, 0xa4, 0xa9, 0x49,
  245. 0xfb, 0xe3, 0x55, 0x96, 0xd5, 0xa0, 0xc2, 0xab,
  246. 0x6f, 0x52, 0x2d, 0x2d, 0x29, 0xbc, 0x98, 0x49,
  247. 0xca, 0x92, 0xaa, 0xae, 0xba, 0x05, 0x29, 0xd8};
  248. NArgonish::TArgon2Factory factory;
  249. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  250. ui8 result[32];
  251. auto argon2id = factory.Create(
  252. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2id,
  253. 2, 64, 4, GenKatSecret, sizeof(GenKatSecret));
  254. argon2id->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  255. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  256. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  257. UNIT_ASSERT(argon2id->Verify(GenKatPassword, sizeof(GenKatPassword),
  258. GenKatSalt, sizeof(GenKatSalt),
  259. TResult, sizeof(TResult),
  260. GenKatAAD, sizeof(GenKatAAD)));
  261. }
  262. }
  263. Y_UNIT_TEST(Argon2d_2p_4th) {
  264. const ui8 TResult[32] = {
  265. 0x8f, 0xa2, 0x7c, 0xed, 0x28, 0x38, 0x79, 0x0f,
  266. 0xba, 0x5c, 0x11, 0x85, 0x1c, 0xdf, 0x90, 0x88,
  267. 0xb2, 0x18, 0x44, 0xd7, 0xf0, 0x4c, 0x97, 0xb2,
  268. 0xca, 0xaf, 0xe4, 0xdc, 0x61, 0x4c, 0xae, 0xb2};
  269. NArgonish::TArgon2Factory factory;
  270. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  271. ui8 result[32];
  272. auto argon2d = factory.Create(
  273. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2d,
  274. 2, 64, 4, GenKatSecret, sizeof(GenKatSecret));
  275. argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  276. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  277. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  278. UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
  279. GenKatSalt, sizeof(GenKatSalt),
  280. TResult, sizeof(TResult),
  281. GenKatAAD, sizeof(GenKatAAD)));
  282. }
  283. }
  284. Y_UNIT_TEST(Argon2i_2p_4th) {
  285. const ui8 TResult[32] = {
  286. 0x61, 0x1c, 0x99, 0x3c, 0xb0, 0xb7, 0x23, 0x16,
  287. 0xbd, 0xa2, 0x6c, 0x4c, 0x2f, 0xe8, 0x2d, 0x39,
  288. 0x9c, 0x8f, 0x1c, 0xfd, 0x45, 0xd9, 0x58, 0xa9,
  289. 0xb4, 0x9c, 0x6c, 0x64, 0xaf, 0xf0, 0x79, 0x0b};
  290. NArgonish::TArgon2Factory factory;
  291. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  292. ui8 result[32];
  293. auto argon2i = factory.Create(
  294. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2i,
  295. 2, 64, 4, GenKatSecret, sizeof(GenKatSecret));
  296. argon2i->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  297. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  298. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  299. UNIT_ASSERT(argon2i->Verify(GenKatPassword, sizeof(GenKatPassword),
  300. GenKatSalt, sizeof(GenKatSalt),
  301. TResult, sizeof(TResult),
  302. GenKatAAD, sizeof(GenKatAAD)));
  303. }
  304. }
  305. Y_UNIT_TEST(Argon2d_128) {
  306. const ui8 TResult[128] = {
  307. 0x4e, 0xc4, 0x6c, 0x4e, 0x8c, 0x32, 0x89, 0x65,
  308. 0xf9, 0x82, 0x2b, 0x00, 0x95, 0x00, 0x50, 0x0a,
  309. 0x72, 0x0d, 0xc5, 0x12, 0x8d, 0x6b, 0xbd, 0x84,
  310. 0x7a, 0xf0, 0x78, 0x5d, 0xa6, 0x14, 0xe3, 0xf1,
  311. 0xac, 0x07, 0x1c, 0xca, 0x12, 0x4d, 0x32, 0xa4,
  312. 0x24, 0x08, 0x5e, 0x07, 0x7c, 0x26, 0xb9, 0x1b,
  313. 0x5c, 0xc0, 0xff, 0xb8, 0x7a, 0x20, 0x00, 0xcb,
  314. 0x07, 0x2b, 0xb4, 0x4d, 0x7b, 0x5b, 0x79, 0x9e,
  315. 0xb4, 0x21, 0xcb, 0x63, 0xeb, 0x46, 0xd7, 0x79,
  316. 0x44, 0x9c, 0x9f, 0xee, 0xa4, 0x17, 0xb5, 0x01,
  317. 0x0f, 0x61, 0x7e, 0xd8, 0xec, 0x1b, 0xe3, 0x8b,
  318. 0x9a, 0x74, 0x17, 0x19, 0x9d, 0x80, 0xe9, 0x20,
  319. 0xd4, 0x84, 0xdd, 0x07, 0x40, 0xb2, 0x26, 0xdb,
  320. 0xf7, 0xbe, 0x79, 0x7f, 0x81, 0x59, 0x86, 0xf3,
  321. 0xe9, 0x34, 0xe4, 0x52, 0xcd, 0x33, 0xb9, 0xf8,
  322. 0x9e, 0x62, 0x65, 0x89, 0xbb, 0xce, 0x7d, 0x65};
  323. NArgonish::TArgon2Factory factory;
  324. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  325. ui8 result[128];
  326. auto argon2d = factory.Create(
  327. (NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2d,
  328. 1, 32, 1, GenKatSecret, sizeof(GenKatSecret));
  329. argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
  330. result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
  331. UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
  332. UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
  333. GenKatSalt, sizeof(GenKatSalt),
  334. TResult, sizeof(TResult),
  335. GenKatAAD, sizeof(GenKatAAD)));
  336. }
  337. }
  338. Y_UNIT_TEST(Blake2B_16_ABC) {
  339. const ui8 TResult[16] = {
  340. 0xcf, 0x4a, 0xb7, 0x91, 0xc6, 0x2b, 0x8d, 0x2b,
  341. 0x21, 0x09, 0xc9, 0x02, 0x75, 0x28, 0x78, 0x16};
  342. const ui8 data[] = {'a', 'b', 'c'};
  343. NArgonish::TBlake2BFactory factory;
  344. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)MaxArch; ++i) {
  345. auto blake2b = factory.Create((NArgonish::EInstructionSet)i, sizeof(TResult));
  346. ui8 hashResult[16] = {0};
  347. blake2b->Update(data, sizeof(data));
  348. blake2b->Final(hashResult, sizeof(hashResult));
  349. UNIT_ASSERT(memcmp(hashResult, TResult, sizeof(TResult)) == 0);
  350. }
  351. }
  352. Y_UNIT_TEST(Blake2B_64_ABC) {
  353. const ui8 TResult[64] = {
  354. 0xba, 0x80, 0xa5, 0x3f, 0x98, 0x1c, 0x4d, 0x0d,
  355. 0x6a, 0x27, 0x97, 0xb6, 0x9f, 0x12, 0xf6, 0xe9,
  356. 0x4c, 0x21, 0x2f, 0x14, 0x68, 0x5a, 0xc4, 0xb7,
  357. 0x4b, 0x12, 0xbb, 0x6f, 0xdb, 0xff, 0xa2, 0xd1,
  358. 0x7d, 0x87, 0xc5, 0x39, 0x2a, 0xab, 0x79, 0x2d,
  359. 0xc2, 0x52, 0xd5, 0xde, 0x45, 0x33, 0xcc, 0x95,
  360. 0x18, 0xd3, 0x8a, 0xa8, 0xdb, 0xf1, 0x92, 0x5a,
  361. 0xb9, 0x23, 0x86, 0xed, 0xd4, 0x00, 0x99, 0x23};
  362. const ui8 data[] = {'a', 'b', 'c'};
  363. NArgonish::TBlake2BFactory factory;
  364. for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)(int)MaxArch; ++i) {
  365. auto blake2b = factory.Create((NArgonish::EInstructionSet)i, sizeof(TResult));
  366. ui8 hashResult[64] = {0};
  367. blake2b->Update(data, sizeof(data));
  368. blake2b->Final(hashResult, sizeof(hashResult));
  369. UNIT_ASSERT(memcmp(hashResult, TResult, sizeof(TResult)) == 0);
  370. }
  371. }
  372. }