mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-24 12:36:01 -07:00
Add a test for blake2 with salt&personalization
This commit is contained in:
parent
f47b7cdb58
commit
deaa893ce4
@ -18,6 +18,7 @@ EXTRA_DIST = \
|
||||
core6.exp \
|
||||
generichash.exp \
|
||||
generichash2.exp \
|
||||
generichash3.exp \
|
||||
hash.exp \
|
||||
hash2.exp \
|
||||
hash3.exp \
|
||||
@ -62,6 +63,7 @@ DISTCLEANFILES = \
|
||||
core6.res \
|
||||
generichash.res \
|
||||
generichash2.res \
|
||||
generichash3.res \
|
||||
hash.res \
|
||||
hash2.res \
|
||||
hash3.res \
|
||||
@ -114,6 +116,7 @@ TESTS_TARGETS = \
|
||||
core6 \
|
||||
generichash \
|
||||
generichash2 \
|
||||
generichash3 \
|
||||
hash \
|
||||
hash3 \
|
||||
onetimeauth \
|
||||
@ -196,6 +199,9 @@ generichash_LDADD = $(TESTS_LDADD)
|
||||
generichash2_SOURCE = cmptest.h generichash2.c
|
||||
generichash2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
generichash3_SOURCE = cmptest.h generichash3.c
|
||||
generichash3_LDADD = $(TESTS_LDADD)
|
||||
|
||||
hash_SOURCE = cmptest.h hash.c
|
||||
hash_LDADD = $(TESTS_LDADD)
|
||||
|
||||
|
36
test/default/generichash3.c
Normal file
36
test/default/generichash3.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "crypto_uint8.h"
|
||||
|
||||
#define TEST_NAME "generichash3"
|
||||
#include "cmptest.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
#define MAXLEN 64
|
||||
crypto_generichash_blake2b_state st;
|
||||
crypto_uint8 salt[crypto_generichash_blake2b_SALTBYTES] = {
|
||||
'5', 'b', '6', 'b', '4', '1', 'e', 'd', '9', 'b', '3', '4', '3', 'f', 'e', '0'
|
||||
};
|
||||
crypto_uint8 personal[crypto_generichash_blake2b_PERSONALBYTES] = {
|
||||
'5', '1', '2', '6', 'f', 'b', '2', 'a', '3', '7', '4', '0', '0', 'd', '2', 'a'
|
||||
};
|
||||
crypto_uint8 in[MAXLEN], out[crypto_generichash_blake2b_BYTES_MAX], k[crypto_generichash_blake2b_KEYBYTES_MAX];
|
||||
size_t h,i,j;
|
||||
|
||||
for(h = 0; h < crypto_generichash_blake2b_KEYBYTES_MAX; ++h) k[h] = h;
|
||||
|
||||
for(i = 0; i < MAXLEN; ++i) {
|
||||
in[i]=i;
|
||||
crypto_generichash_blake2b_init_salt_personal(&st, k, 1 + i % crypto_generichash_blake2b_KEYBYTES_MAX,
|
||||
1 + i % crypto_generichash_blake2b_BYTES_MAX,
|
||||
salt, personal);
|
||||
crypto_generichash_blake2b_update(&st, in, i);
|
||||
crypto_generichash_blake2b_final(&st, out, 1 + i % crypto_generichash_blake2b_BYTES_MAX);
|
||||
for (j = 0;j < 1 + i % crypto_generichash_blake2b_BYTES_MAX;++j) {
|
||||
printf("%02x",(unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
64
test/default/generichash3.exp
Normal file
64
test/default/generichash3.exp
Normal file
@ -0,0 +1,64 @@
|
||||
ba
|
||||
6139
|
||||
3a1666
|
||||
5797e9d0
|
||||
834a26efe6
|
||||
d7e9e862bbce
|
||||
40d8b84c374750
|
||||
276789189244cf04
|
||||
16f73ffe0673cc9992
|
||||
b3835bfaf6eb71d94078
|
||||
8c624e844d34f4a59f34cc
|
||||
e0a394962413ad09975df3cf
|
||||
47f043c3aacb501f97e0458ae3
|
||||
b4a11f2fb72a7e6f96fdacf98d49
|
||||
f434079e9adeb244047cb6855f9854
|
||||
5fbe885c4b2d4e0d78dc5905622a277a
|
||||
e262ba3e2ab76efdf83513108e3b987d1b
|
||||
add93dde78d32e77bc039c34a49043f19d26
|
||||
093842ac10e2eb1237ddc9ca9e7990cf397772
|
||||
09e7f6a0e2ea4888f1dbf6562effd1561c65029c
|
||||
bd33a9ec914f5b81864a49184338e4062d6c6b2b2e
|
||||
8dc46295235d94f5881d429a5ad47f9db9e35cf8c6b3
|
||||
ba5df554dca7ac1cba4889fa88adf3070fbf4ab5d187b5
|
||||
1ff84715e71c66214d271d421395fb6166db97b1d47ed697
|
||||
75a0d227c70549f5b0c933b7b21f151355bd47e04b6085c91f
|
||||
a32a5c9439a0fa771dcbe7f338b5dcef62a754edc4952614d6f0
|
||||
53a87de519cdcc7f64730d58bce6baaf7b44c5c428a4611a208ad4
|
||||
5e5ad8f0c4f083f9b7a5154d9c0dfd0f3d2fce94cf54fc215450314a
|
||||
9c76b9e63c77e6564b1e5111c2fb140046e1e5a4f900a7cfc2bac3fcfa
|
||||
bb919251ca310eb9b994e5d7883bc9fa2144b59b8d5d940677b7130ac777
|
||||
faa492a66f08ef0c7adb868fcb7b523aedd35b8ff1414bd1d554794f144474
|
||||
9b273ebe335540b87be899abe169389ed61ed262c3a0a16e4998bbf752f0bee3
|
||||
1e0070b92429c151b33bdd1bb4430a0e650a3dfc94d404054e93c8568330ecc505
|
||||
e3b64149f1b76231686d592d1d4af984ce2826ba03c2224a92f95f9526130ce4eb40
|
||||
5f8e378120b73db9eefa65ddcdcdcb4acd8046c31a5e47f298caa400937d5623f1394b
|
||||
74c757a4165a1782c933e587353a9fd8f6d7bf26b7f51b52c542747030bfb3d560c2e5c2
|
||||
2d5ee85cc238b923806dd98db18919d1924f2340ec88917d4ce1799cbfd5f2cb9df99db2e1
|
||||
c93ff727e6f9822efec0a77eed0025c0eff19127bf8746b7c71c2a098f57cef02febb86a1e6c
|
||||
adfb6d7ba13779a5dd1bbf268e400f4156f0f5c9d5b670ff539e1d9c1a63373416f3001f338407
|
||||
3a6900e58a448887d77c5911e4bdde620e64f25b2d71723fa60f7cb3efa7c320b6153bdbc3287949
|
||||
413eb0fd379b32dd88e82242a87cc58ce3e64c72352387a4c70f92ee5c8d23fa7ecd86f6df170a32d2
|
||||
92d0d3cacc3e25628caf6f2c4cd50d25d154ac45098f531d690230b859f37cfe089eb169f76bba72a3ff
|
||||
92f6ccc11a9a3bee520b17e0cddc4550c0e9cf47ddd9a6161284259ffb161c1d0675b505cb1066872768e8
|
||||
a3cd675804e6be7f120138a9eaadcd56bb7763d1c046e87fe0d358c8276b0d24621f46c60b46e397933b75b4
|
||||
304a1af53cbdd6486b8419d1ebd5e9528c540d8dc46a10be49067f46a0617229577015d776783f702b2954df43
|
||||
d8a6358970446453ac0c82c758644ab68989b5b4f06f9768807ce0c5f2a0dbac1e8450f4e3a02deecf7b54b6a45d
|
||||
1264b8dee9ac4aa8de69a43ada95cc95f20230f33836d4a1db8c2466ab38361686e5ac282025ccc2e0f6a1cd98a4dd
|
||||
7eed787abaa7f4e8b8aa3090f0676201cfbaaf350899661cdd5216ac0b5cd874443f5c0688ffd7ca1ccbfe1ca7e1a3f5
|
||||
8907f0218585167962a8e8213559a643dd03c2bf1a7a5ad3e3bc5f88c0ff1532ee8cd29880e7e0e68da22a5798aef27cc5
|
||||
12dea17b0733e5060751b1115e10c3d4b2f4583bcd009d9f1f42ec23d4a6a0df1185d3abbdbe86de08569e70583d6de1c1fe
|
||||
8ff75e91f1de547dc3a25472db2f51f5910a290c449603da54207b5e39bd735d240ec913b52df90709b5d29357971d6c341452
|
||||
4a3b16b12400f38e74778efc3a4caa52ec6fdf6b0180a5bfac9189e52e162c10e8911a54ab33e2b389ee1949e58edaa119e2b2b9
|
||||
c9943e7186fdc9bbfa1d7087fa7086babe6fcf95a6196d1772187854071304e2f1fff39e6e6f48f76addb16d5c00249e0523aac91f
|
||||
0297f16fdd34add9cc87b4adf816525b590ba08ac733c43f8d225d194df4f9c83b4dce617be51e25b5f6c80dff249f27c707de20e422
|
||||
576bb891eab9930998e2e73b5d0498e3c5f040f8dec9397a8c7a622c17de01fee7cc936e3bd4de1f7fd8b31dea9e70c65462bbb5dc7b50
|
||||
9416a57ae7c8c51c6e008f940fe06d8ebc02c350c19a2f71583a6d260b085670d73a95248fef0f4cae5292ba7db1189a7cd9c51122ba7913
|
||||
ea644b9051cca5eee8868a553e3f0f4e14739e1555474151156e10578256b288a233870dd43a380765400ea446df7f452c1e03a9e5b6731256
|
||||
f99cc1603de221abc1ecb1a7eb4bbf06e99561d1cc5541d8d601bae2b1dd3cbe448ac276667f26de5e269183a09f7deaf35d33174b3cc8ad4aa2
|
||||
ee2be1ec57fdac23f89402a534177eca0f4b982a4ed2c2e900b6a79e1f47a2d023eff2e647baf4f4c0da3a28d08a44bc780516974074e2523e6651
|
||||
9cda001868949a2bad96c5b3950a8315e6e5214d0b54dcd596280565d351806ef22cf3053f63623da72fcad9afa3896641658632334c9ec4f644c984
|
||||
c6d6722a916651a8671383d8260873347d9c248696b4cb3dac4dea9ba57ed971127cb18e44211d7e14177ace248b3c6e0785356ee261ebdc6ef0faf143
|
||||
5dd258a3e7505bc6b9776b0df25676a1c19e2c8258c7b5f2e361423523d96299eb6827bc7c27e7bca2d2b59d717c2ebcb05e6dcaa32289d96fae9a4077ef
|
||||
19c14de35fe19c92cc0e624280e4136355d4cfa9a0a98b090c4b06f5665021920725852ff1f566b0c8c37157b25fb9f947a2e70b40577a17860a0732c170ac
|
||||
5fcdcc02be7714a0dbc77df498bf999ea9225d564adca1c121c9af03af92cac8177b9b4a86bcc47c79aa32aac58a3fef967b2132e9352d4613fe890beed2571b
|
Loading…
Reference in New Issue
Block a user