mirror of
https://github.com/BLAKE2/BLAKE2
synced 2024-11-22 02:31:57 +01:00
issue #41
This commit is contained in:
parent
7728c30896
commit
5cbb39c9ef
@ -25,10 +25,10 @@
|
||||
|
||||
#define LENGTH 256
|
||||
|
||||
#define MAKE_KAT(name, size_prefix) \
|
||||
#define MAKE_KAT(name, size_prefix, first) \
|
||||
do { \
|
||||
for (i = 0; i < LENGTH; ++i) { \
|
||||
printf("\n{\n"); \
|
||||
printf("%s\n{\n", i == 0 && first ? "" : ","); \
|
||||
\
|
||||
printf(" \"hash\": \"" #name "\",\n"); \
|
||||
printf(" \"in\": \""); \
|
||||
@ -44,14 +44,14 @@
|
||||
for (j = 0; j < size_prefix##_OUTBYTES; ++j) \
|
||||
printf("%02x", hash[j]); \
|
||||
printf("\"\n"); \
|
||||
printf("},"); \
|
||||
printf("}"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MAKE_KEYED_KAT(name, size_prefix) \
|
||||
#define MAKE_KEYED_KAT(name, size_prefix, first) \
|
||||
do { \
|
||||
for (i = 0; i < LENGTH; ++i) { \
|
||||
printf("\n{\n"); \
|
||||
printf("%s\n{\n", i == 0 && first ? "" : ","); \
|
||||
\
|
||||
printf(" \"hash\": \"" #name "\",\n"); \
|
||||
printf(" \"in\": \""); \
|
||||
@ -70,14 +70,14 @@
|
||||
for (j = 0; j < size_prefix##_OUTBYTES; ++j) \
|
||||
printf("%02x", hash[j]); \
|
||||
printf("\"\n"); \
|
||||
printf("},"); \
|
||||
printf("}"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MAKE_XOF_KAT(name) \
|
||||
#define MAKE_XOF_KAT(name, first) \
|
||||
do { \
|
||||
for (i = 1; i <= LENGTH; ++i) { \
|
||||
printf("\n{\n"); \
|
||||
printf("%s\n{\n", i == 1 && first ? "" : ","); \
|
||||
\
|
||||
printf(" \"hash\": \"" #name "\",\n"); \
|
||||
printf(" \"in\": \""); \
|
||||
@ -93,14 +93,14 @@
|
||||
for (j = 0; j < i; ++j) \
|
||||
printf("%02x", hash[j]); \
|
||||
printf("\"\n"); \
|
||||
printf("},"); \
|
||||
printf("}"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MAKE_XOF_KEYED_KAT(name, size_prefix) \
|
||||
#define MAKE_XOF_KEYED_KAT(name, size_prefix, first) \
|
||||
do { \
|
||||
for (i = 1; i <= LENGTH; ++i) { \
|
||||
printf("\n{\n"); \
|
||||
printf("%s\n{\n", i == 1 && first ? "" : ","); \
|
||||
\
|
||||
printf(" \"hash\": \"" #name "\",\n"); \
|
||||
printf(" \"in\": \""); \
|
||||
@ -119,7 +119,7 @@
|
||||
for (j = 0; j < i; ++j) \
|
||||
printf("%02x", hash[j]); \
|
||||
printf("\"\n"); \
|
||||
printf("},"); \
|
||||
printf("}"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@ -136,18 +136,18 @@ int main() {
|
||||
key[i] = i;
|
||||
|
||||
printf("[");
|
||||
MAKE_KAT(blake2s, BLAKE2S);
|
||||
MAKE_KEYED_KAT(blake2s, BLAKE2S);
|
||||
MAKE_KAT(blake2b, BLAKE2B);
|
||||
MAKE_KEYED_KAT(blake2b, BLAKE2B);
|
||||
MAKE_KAT(blake2sp, BLAKE2S);
|
||||
MAKE_KEYED_KAT(blake2sp, BLAKE2S);
|
||||
MAKE_KAT(blake2bp, BLAKE2B);
|
||||
MAKE_KEYED_KAT(blake2bp, BLAKE2B);
|
||||
MAKE_XOF_KAT(blake2xs);
|
||||
MAKE_XOF_KEYED_KAT(blake2xs, BLAKE2S);
|
||||
MAKE_XOF_KAT(blake2xb);
|
||||
MAKE_XOF_KEYED_KAT(blake2xb, BLAKE2B);
|
||||
MAKE_KAT(blake2s, BLAKE2S, 1);
|
||||
MAKE_KEYED_KAT(blake2s, BLAKE2S, 0);
|
||||
MAKE_KAT(blake2b, BLAKE2B, 0);
|
||||
MAKE_KEYED_KAT(blake2b, BLAKE2B, 0);
|
||||
MAKE_KAT(blake2sp, BLAKE2S, 0);
|
||||
MAKE_KEYED_KAT(blake2sp, BLAKE2S, 0);
|
||||
MAKE_KAT(blake2bp, BLAKE2B, 0);
|
||||
MAKE_KEYED_KAT(blake2bp, BLAKE2B, 0);
|
||||
MAKE_XOF_KAT(blake2xs, 0);
|
||||
MAKE_XOF_KEYED_KAT(blake2xs, BLAKE2S, 0);
|
||||
MAKE_XOF_KAT(blake2xb, 0);
|
||||
MAKE_XOF_KEYED_KAT(blake2xb, BLAKE2B, 0);
|
||||
printf("\n]\n");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
|
@ -25,10 +25,10 @@
|
||||
|
||||
#define LENGTH 256
|
||||
|
||||
#define MAKE_KAT(name, size_prefix) \
|
||||
#define MAKE_KAT(name, size_prefix, first) \
|
||||
do { \
|
||||
for (i = 0; i < LENGTH; ++i) { \
|
||||
printf("\n{\n"); \
|
||||
printf("%s\n{\n", i == 0 && first ? "" : ","); \
|
||||
\
|
||||
printf(" \"hash\": \"" #name "\",\n"); \
|
||||
printf(" \"in\": \""); \
|
||||
@ -44,14 +44,14 @@
|
||||
for (j = 0; j < size_prefix##_OUTBYTES; ++j) \
|
||||
printf("%02x", hash[j]); \
|
||||
printf("\"\n"); \
|
||||
printf("},"); \
|
||||
printf("}"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MAKE_KEYED_KAT(name, size_prefix) \
|
||||
#define MAKE_KEYED_KAT(name, size_prefix, first) \
|
||||
do { \
|
||||
for (i = 0; i < LENGTH; ++i) { \
|
||||
printf("\n{\n"); \
|
||||
printf("%s\n{\n", i == 0 && first ? "" : ","); \
|
||||
\
|
||||
printf(" \"hash\": \"" #name "\",\n"); \
|
||||
printf(" \"in\": \""); \
|
||||
@ -70,14 +70,14 @@
|
||||
for (j = 0; j < size_prefix##_OUTBYTES; ++j) \
|
||||
printf("%02x", hash[j]); \
|
||||
printf("\"\n"); \
|
||||
printf("},"); \
|
||||
printf("}"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MAKE_XOF_KAT(name) \
|
||||
#define MAKE_XOF_KAT(name, first) \
|
||||
do { \
|
||||
for (i = 1; i <= LENGTH; ++i) { \
|
||||
printf("\n{\n"); \
|
||||
printf("%s\n{\n", i == 1 && first ? "" : ","); \
|
||||
\
|
||||
printf(" \"hash\": \"" #name "\",\n"); \
|
||||
printf(" \"in\": \""); \
|
||||
@ -93,14 +93,14 @@
|
||||
for (j = 0; j < i; ++j) \
|
||||
printf("%02x", hash[j]); \
|
||||
printf("\"\n"); \
|
||||
printf("},"); \
|
||||
printf("}"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MAKE_XOF_KEYED_KAT(name, size_prefix) \
|
||||
#define MAKE_XOF_KEYED_KAT(name, size_prefix, first) \
|
||||
do { \
|
||||
for (i = 1; i <= LENGTH; ++i) { \
|
||||
printf("\n{\n"); \
|
||||
printf("%s\n{\n", i == 1 && first ? "" : ","); \
|
||||
\
|
||||
printf(" \"hash\": \"" #name "\",\n"); \
|
||||
printf(" \"in\": \""); \
|
||||
@ -119,7 +119,7 @@
|
||||
for (j = 0; j < i; ++j) \
|
||||
printf("%02x", hash[j]); \
|
||||
printf("\"\n"); \
|
||||
printf("},"); \
|
||||
printf("}"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@ -136,18 +136,18 @@ int main() {
|
||||
key[i] = i;
|
||||
|
||||
printf("[");
|
||||
MAKE_KAT(blake2s, BLAKE2S);
|
||||
MAKE_KEYED_KAT(blake2s, BLAKE2S);
|
||||
MAKE_KAT(blake2b, BLAKE2B);
|
||||
MAKE_KEYED_KAT(blake2b, BLAKE2B);
|
||||
MAKE_KAT(blake2sp, BLAKE2S);
|
||||
MAKE_KEYED_KAT(blake2sp, BLAKE2S);
|
||||
MAKE_KAT(blake2bp, BLAKE2B);
|
||||
MAKE_KEYED_KAT(blake2bp, BLAKE2B);
|
||||
MAKE_XOF_KAT(blake2xs);
|
||||
MAKE_XOF_KEYED_KAT(blake2xs, BLAKE2S);
|
||||
MAKE_XOF_KAT(blake2xb);
|
||||
MAKE_XOF_KEYED_KAT(blake2xb, BLAKE2B);
|
||||
MAKE_KAT(blake2s, BLAKE2S, 1);
|
||||
MAKE_KEYED_KAT(blake2s, BLAKE2S, 0);
|
||||
MAKE_KAT(blake2b, BLAKE2B, 0);
|
||||
MAKE_KEYED_KAT(blake2b, BLAKE2B, 0);
|
||||
MAKE_KAT(blake2sp, BLAKE2S, 0);
|
||||
MAKE_KEYED_KAT(blake2sp, BLAKE2S, 0);
|
||||
MAKE_KAT(blake2bp, BLAKE2B, 0);
|
||||
MAKE_KEYED_KAT(blake2bp, BLAKE2B, 0);
|
||||
MAKE_XOF_KAT(blake2xs, 0);
|
||||
MAKE_XOF_KEYED_KAT(blake2xs, BLAKE2S, 0);
|
||||
MAKE_XOF_KAT(blake2xb, 0);
|
||||
MAKE_XOF_KEYED_KAT(blake2xb, BLAKE2B, 0);
|
||||
printf("\n]\n");
|
||||
fflush(stdout);
|
||||
return 0;
|
||||
|
@ -18430,5 +18430,5 @@
|
||||
"in": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
|
||||
"key": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f",
|
||||
"out": "1e9b2c454e9de3a2d723d850331037dbf54133dbe27488ff757dd255833a27d8eb8a128ad12d0978b6884e25737086a704fb289aaaccf930d5b582ab4df1f55f0c429b6875edec3fe45464fa74164be056a55e243c4222c586bec5b18f39036aa903d98180f24f83d09a454dfa1e03a60e6a3ba4613e99c35f874d790174ee48a557f4f021ade4d1b278d7997ef094569b37b3db0505951e9ee8400adaea275c6db51b325ee730c69df97745b556ae41cd98741e28aa3a49544541eeb3da1b1e8fa4e8e9100d66dd0c7f5e2c271b1ecc077de79c462b9fe4c273543ecd82a5bea63c5acc01eca5fb780c7d7c8c9fe208ae8bd50cad1769693d92c6c8649d20d8"
|
||||
},
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user