aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/digest/argonish/ut/ut.cpp
diff options
context:
space:
mode:
authorcerevra <cerevra@yandex-team.ru>2022-02-10 16:45:58 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:58 +0300
commitbf41dd01f6c920583e9faae7cd55ed25e547e052 (patch)
treeec7c8c285ffa648a5c5efeff453787a15ab811ac /library/cpp/digest/argonish/ut/ut.cpp
parente2c3e3004f7cd68441cefcfa4aaccd3d8051c846 (diff)
downloadydb-bf41dd01f6c920583e9faae7cd55ed25e547e052.tar.gz
Restoring authorship annotation for <cerevra@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/digest/argonish/ut/ut.cpp')
-rw-r--r--library/cpp/digest/argonish/ut/ut.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/digest/argonish/ut/ut.cpp b/library/cpp/digest/argonish/ut/ut.cpp
index 12ef530a18..e7d8b795b9 100644
--- a/library/cpp/digest/argonish/ut/ut.cpp
+++ b/library/cpp/digest/argonish/ut/ut.cpp
@@ -1,5 +1,5 @@
-#include <library/cpp/digest/argonish/argon2.h>
-#include <library/cpp/digest/argonish/blake2b.h>
+#include <library/cpp/digest/argonish/argon2.h>
+#include <library/cpp/digest/argonish/blake2b.h>
#include <library/cpp/testing/unittest/registar.h>
Y_UNIT_TEST_SUITE(ArgonishTest) {
@@ -134,7 +134,7 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
const ui32 mcost = 16;
const ui32 tcost = 1;
TArrayHolder<ui8> memory(new ui8[mcost * 1024]);
- const ui8 TResult[165] = {
+ const ui8 TResult[165] = {
0xe6, 0xff, 0x7b, 0xa1, 0xfa, 0x93, 0x0a, 0x51,
0x24, 0xf3, 0xbc, 0xc4, 0x98, 0xe2, 0x32, 0x08,
0x22, 0x7d, 0x4d, 0xf9, 0xe7, 0x2c, 0xd2, 0xd8,
@@ -163,13 +163,13 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)maxInstructionSet; ++i) {
auto argon2d = factory.Create((NArgonish::EInstructionSet)i, NArgonish::EArgon2Type::Argon2d, tcost, mcost, 1,
FrSecret, sizeof(FrSecret));
- ui8 hashResult[sizeof(TResult)];
+ ui8 hashResult[sizeof(TResult)];
argon2d->HashWithCustomMemory(memory.Get(), mcost * 1024, FrPassword, sizeof(FrPassword),
FrSalt, sizeof(FrSalt), hashResult, sizeof(hashResult));
- UNIT_ASSERT(memcmp(hashResult, TResult, sizeof(hashResult)) == 0);
+ UNIT_ASSERT(memcmp(hashResult, TResult, sizeof(hashResult)) == 0);
UNIT_ASSERT(argon2d->VerifyWithCustomMemory(memory.Get(), mcost * 1024, FrPassword, sizeof(FrPassword),
- FrSalt, sizeof(FrSalt), TResult, sizeof(TResult)));
+ FrSalt, sizeof(FrSalt), TResult, sizeof(TResult)));
}
} catch (...) {
UNIT_FAIL("Argon2 fraction len test fail");
@@ -195,7 +195,7 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
}
Y_UNIT_TEST(Argon2d) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x7b, 0xa5, 0xa1, 0x7a, 0x72, 0xf7, 0xe5, 0x99,
0x77, 0xf7, 0xf2, 0x3d, 0x10, 0xe6, 0x21, 0x89,
0x8c, 0x63, 0xce, 0xbe, 0xed, 0xda, 0xbd, 0x15,
@@ -212,17 +212,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2i) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x87, 0x4d, 0x23, 0xfb, 0x9f, 0x55, 0xe2, 0xff,
0x66, 0xbc, 0x19, 0x03, 0x46, 0xe7, 0x01, 0x19,
0x7c, 0x9f, 0x25, 0xd1, 0x1d, 0xa4, 0x5a, 0xad,
@@ -239,17 +239,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2i->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2i->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2id) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x99, 0xdf, 0xcf, 0xc2, 0x89, 0x76, 0x93, 0x9d,
0xa2, 0x97, 0x09, 0x44, 0x34, 0xd8, 0x6f, 0xd0,
0x0c, 0x94, 0x9a, 0x0f, 0x31, 0x8c, 0x22, 0xf0,
@@ -266,17 +266,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2id->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2id->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2d_2p) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x59, 0xb0, 0x94, 0x62, 0xcf, 0xdc, 0xd2, 0xb4,
0x0a, 0xbd, 0x17, 0x81, 0x0a, 0x47, 0x4a, 0x8e,
0xc1, 0xab, 0xb7, 0xc1, 0x8d, 0x07, 0x53, 0x7c,
@@ -293,17 +293,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2i_2p) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0xc1, 0x0f, 0x00, 0x5e, 0xf8, 0x78, 0xc8, 0x07,
0x0e, 0x2c, 0xc5, 0x2f, 0x57, 0x75, 0x25, 0xc9,
0x71, 0xc7, 0x30, 0xeb, 0x00, 0x64, 0x4a, 0x4e,
@@ -320,17 +320,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2i->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2i->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2id_2p) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x6c, 0x00, 0xb7, 0xa9, 0x00, 0xe5, 0x00, 0x4c,
0x24, 0x46, 0x9e, 0xc1, 0xe7, 0xc0, 0x1a, 0x99,
0xb2, 0xb8, 0xf7, 0x73, 0x75, 0xd4, 0xec, 0xa7,
@@ -347,17 +347,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2id->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2id->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2d_2p_2th) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x2b, 0x47, 0x35, 0x39, 0x4a, 0x40, 0x3c, 0xc9,
0x05, 0xfb, 0x51, 0x25, 0x96, 0x68, 0x64, 0x43,
0x02, 0x16, 0x38, 0xa6, 0xc1, 0x58, 0xfc, 0x8d,
@@ -374,17 +374,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2id_2p_4th) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x4f, 0x93, 0xb5, 0xad, 0x78, 0xa4, 0xa9, 0x49,
0xfb, 0xe3, 0x55, 0x96, 0xd5, 0xa0, 0xc2, 0xab,
0x6f, 0x52, 0x2d, 0x2d, 0x29, 0xbc, 0x98, 0x49,
@@ -401,17 +401,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2id->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2id->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2d_2p_4th) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x8f, 0xa2, 0x7c, 0xed, 0x28, 0x38, 0x79, 0x0f,
0xba, 0x5c, 0x11, 0x85, 0x1c, 0xdf, 0x90, 0x88,
0xb2, 0x18, 0x44, 0xd7, 0xf0, 0x4c, 0x97, 0xb2,
@@ -428,17 +428,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2i_2p_4th) {
- const ui8 TResult[32] = {
+ const ui8 TResult[32] = {
0x61, 0x1c, 0x99, 0x3c, 0xb0, 0xb7, 0x23, 0x16,
0xbd, 0xa2, 0x6c, 0x4c, 0x2f, 0xe8, 0x2d, 0x39,
0x9c, 0x8f, 0x1c, 0xfd, 0x45, 0xd9, 0x58, 0xa9,
@@ -455,17 +455,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2i->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2i->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Argon2d_128) {
- const ui8 TResult[128] = {
+ const ui8 TResult[128] = {
0x4e, 0xc4, 0x6c, 0x4e, 0x8c, 0x32, 0x89, 0x65,
0xf9, 0x82, 0x2b, 0x00, 0x95, 0x00, 0x50, 0x0a,
0x72, 0x0d, 0xc5, 0x12, 0x8d, 0x6b, 0xbd, 0x84,
@@ -494,17 +494,17 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
argon2d->Hash(GenKatPassword, sizeof(GenKatPassword), GenKatSalt, sizeof(GenKatSalt),
result, sizeof(result), GenKatAAD, sizeof(GenKatAAD));
- UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
+ UNIT_ASSERT(memcmp(result, TResult, sizeof(result)) == 0);
UNIT_ASSERT(argon2d->Verify(GenKatPassword, sizeof(GenKatPassword),
GenKatSalt, sizeof(GenKatSalt),
- TResult, sizeof(TResult),
+ TResult, sizeof(TResult),
GenKatAAD, sizeof(GenKatAAD)));
}
}
Y_UNIT_TEST(Blake2B_16_ABC) {
- const ui8 TResult[16] = {
+ const ui8 TResult[16] = {
0xcf, 0x4a, 0xb7, 0x91, 0xc6, 0x2b, 0x8d, 0x2b,
0x21, 0x09, 0xc9, 0x02, 0x75, 0x28, 0x78, 0x16};
const ui8 data[] = {'a', 'b', 'c'};
@@ -512,18 +512,18 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
NArgonish::TBlake2BFactory factory;
NArgonish::EInstructionSet maxInstructionSet = factory.GetInstructionSet();
for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)maxInstructionSet; ++i) {
- auto blake2b = factory.Create((NArgonish::EInstructionSet)i, sizeof(TResult));
+ auto blake2b = factory.Create((NArgonish::EInstructionSet)i, sizeof(TResult));
ui8 hashResult[16] = {0};
blake2b->Update(data, sizeof(data));
blake2b->Final(hashResult, sizeof(hashResult));
- UNIT_ASSERT(memcmp(hashResult, TResult, sizeof(TResult)) == 0);
+ UNIT_ASSERT(memcmp(hashResult, TResult, sizeof(TResult)) == 0);
}
}
Y_UNIT_TEST(Blake2B_64_ABC) {
- const ui8 TResult[64] = {
+ const ui8 TResult[64] = {
0xba, 0x80, 0xa5, 0x3f, 0x98, 0x1c, 0x4d, 0x0d,
0x6a, 0x27, 0x97, 0xb6, 0x9f, 0x12, 0xf6, 0xe9,
0x4c, 0x21, 0x2f, 0x14, 0x68, 0x5a, 0xc4, 0xb7,
@@ -537,13 +537,13 @@ Y_UNIT_TEST_SUITE(ArgonishTest) {
NArgonish::TBlake2BFactory factory;
NArgonish::EInstructionSet maxInstructionSet = factory.GetInstructionSet();
for (int i = (int)NArgonish::EInstructionSet::REF; i <= (int)maxInstructionSet; ++i) {
- auto blake2b = factory.Create((NArgonish::EInstructionSet)i, sizeof(TResult));
+ auto blake2b = factory.Create((NArgonish::EInstructionSet)i, sizeof(TResult));
ui8 hashResult[64] = {0};
blake2b->Update(data, sizeof(data));
blake2b->Final(hashResult, sizeof(hashResult));
- UNIT_ASSERT(memcmp(hashResult, TResult, sizeof(TResult)) == 0);
+ UNIT_ASSERT(memcmp(hashResult, TResult, sizeof(TResult)) == 0);
}
}
}