9#include "arcane/utils/PlatformUtils.h"
10#include "arcane/utils/Array.h"
11#include "arcane/utils/String.h"
12#include "arcane/utils/Convert.h"
13#include "arcane/utils/MD5HashAlgorithm.h"
14#include "arcane/utils/SHA3HashAlgorithm.h"
15#include "arcane/utils/SHA1HashAlgorithm.h"
16#include "arcane/utils/Ref.h"
18#include <gtest/gtest.h>
52 if (
algo.hasCreateContext()){
53 context =
algo.createContext();
70 context->updateHash(
span1);
71 context->updateHash(
span2);
73 context->computeHashValue(value);
97 String expected_hash =
ti.expected_hash.lower();
98 std::cout <<
"REF=" << expected_hash <<
"\n";
99 std::cout <<
"HASH1=" <<
hash1 <<
"\n";
100 std::cout <<
"HASH2=" << hash2 <<
"\n";
101 std::cout <<
"HASH3=" <<
hash3 <<
"\n";
102 std::cout <<
"HASH4=" <<
hash4 <<
"\n";
118 bytes[i] = std::byte(i % 127);
122 for (
int j = 0;
j < 2; ++
j) {
127 std::cout <<
"HASH_BIG=" <<
hash_big <<
"\n";
135 context->updateHash(bytes.span().subspan(i,
to_add));
138 context->computeHashValue(value);
141 std::cout <<
"nb_iter=" <<
nb_iter <<
"\n";
153 std::cout <<
"TEST_SHA3-224\n";
156 { {
"",
"6B4E03423667DBB73B6E15454F0EB1ABD4597F9A1B078E3F5B5A6BC7" },
157 {
"a",
"9E86FF69557CA95F405F081269685B38E3A819B309EE942F482B6A8B" },
158 {
"abc",
"E642824C3F8CF24AD09234EE7D3C766FC9A3A5168D0C94AD73B46FDF" },
159 {
"message digest",
"18768BB4C48EB7FC88E5DDB17EFCF2964ABD7798A39D86A4B4A1E4C8" },
160 {
"abcdefghijklmnopqrstuvwxyz",
"5CDECA81E123F87CAD96B9CBA999F16F6D41549608D4E0F4681B8239" },
161 {
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
"A67C289B8250A6F437A20137985D605589A8C163D45261B15419556E" },
162 {
"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
"0526898E185869F91B3E2A76DD72A15DC6940A67C8164A044CD25CC8" },
163 {
"The quick brown fox jumps over the lazy dog",
"D15DADCEAA4D5D7BB3B48F446421D542E08AD8887305E28D58335795" } }
175 std::cout <<
"TEST_SHA3-256\n";
179 "a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a" },
182 "80084bf2fba02475726feb2cab2d8215eab14bc6bdd8bfb2c8151257032ecd8b" },
185 "3a985da74fe225b2045c172d6bd390bd855f086e3e9d525b46bfe24511431532" },
188 "edcdb2069366e75243860c18c3a11465eca34bce6143d30c8665cefcfd32bffd" },
190 {
"abcdefghijklmnopqrstuvwxyz",
191 "7cab2dc765e21b241dbc1c255ce620b29f527c6d5e7f5f843e56288f0d707521" },
193 {
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
194 "a79d6a9da47f04a3b9a9323ec9991f2105d4c78a7bc7beeb103855a7a11dfb9f" },
196 {
"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
197 "293e5ce4ce54ee71990ab06e511b7ccd62722b1beb414f5ff65c8274e0f5be1d" },
199 {
"The quick brown fox jumps over the lazy dog",
200 "69070dda01975c8c120c3aada1b282394e7f032fa9cf32f4cb2259a0897dfc04" } }
212 std::cout <<
"TEST_SHA3-384\n";
215 { {
"",
"0C63A75B845E4F7D01107D852E4C2485C51A50AAAA94FC61995E71BBEE983A2AC3713831264ADB47FB6BD1E058D5F004" },
216 {
"a",
"1815F774F320491B48569EFEC794D249EEB59AAE46D22BF77DAFE25C5EDC28D7EA44F93EE1234AA88F61C91912A4CCD9" },
217 {
"abc",
"EC01498288516FC926459F58E2C6AD8DF9B473CB0FC08C2596DA7CF0E49BE4B298D88CEA927AC7F539F1EDF228376D25" },
219 "D9519709F44AF73E2C8E291109A979DE3D61DC02BF69DEF7FBFFDFFFE662751513F19AD57E17D4B93BA1E484FC1980D5" },
220 {
"abcdefghijklmnopqrstuvwxyz",
221 "FED399D2217AAF4C717AD0C5102C15589E1C990CC2B9A5029056A7F7485888D6AB65DB2370077A5CADB53FC9280D278F" },
222 {
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
223 "D5B972302F5080D0830E0DE7B6B2CF383665A008F4C4F386A61112652C742D20CB45AA51BD4F542FC733E2719E999291" },
224 {
"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
225 "3C213A17F514638ACB3BF17F109F3E24C16F9F14F085B52A2F2B81ADC0DB83DF1A58DB2CE013191B8BA72D8FAE7E2A5E" },
226 {
"The quick brown fox jumps over the lazy dog",
227 "7063465E08A93BCE31CD89D2E3CA8F602498696E253592ED26F07BF7E703CF328581E1471A7BA7AB119B1A9EBDF8BE41" } }
239 std::cout <<
"TEST_SHA3-512\n";
242 { {
"",
"A69F73CCA23A9AC5C8B567DC185A756E97C982164FE25859E0D1DCC1475C80A615B2123AF1F5F94C11E3E9402C3AC558F500199D95B6D3E301758586281DCD26" },
243 {
"a",
"697F2D856172CB8309D6B8B97DAC4DE344B549D4DEE61EDFB4962D8698B7FA803F4F93FF24393586E28B5B957AC3D1D369420CE53332712F997BD336D09AB02A" },
244 {
"abc",
"B751850B1A57168A5693CD924B6B096E08F621827444F70D884F5D0240D2712E10E116E9192AF3C91A7EC57647E3934057340B4CF408D5A56592F8274EEC53F0" },
246 "3444E155881FA15511F57726C7D7CFE80302A7433067B29D59A71415CA9DD141AC892D310BC4D78128C98FDA839D18D7F0556F2FE7ACB3C0CDA4BFF3A25F5F59" },
247 {
"abcdefghijklmnopqrstuvwxyz",
248 "AF328D17FA28753A3C9F5CB72E376B90440B96F0289E5703B729324A975AB384EDA565FC92AADED143669900D761861687ACDC0A5FFA358BD0571AAAD80ACA68" },
249 {
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
250 "D1DB17B4745B255E5EB159F66593CC9C143850979FC7A3951796ABA80165AAB536B46174CE19E3F707F0E5C6487F5F03084BC0EC9461691EF20113E42AD28163" },
251 {
"12345678901234567890123456789012345678901234567890123456789012345678901234567890",
252 "9524B9A5536B91069526B4F6196B7E9475B4DA69E01F0C855797F224CD7335DDB286FD99B9B32FFE33B59AD424CC1744F6EB59137F5FB8601932E8A8AF0AE930" },
253 {
"The quick brown fox jumps over the lazy dog",
254 "01DEDD5DE4EF14642445BA5F5B97C15E47B9AD931326E4B0727CD94CEFC44FFF23F07BF543139939B49128CAF436DC1BDEE54FCB24023A08D9403F9B4BF0D450" } }
266 std::cout <<
"TEST_SHA1\n";
269 { {
"",
"da39a3ee5e6b4b0d3255bfef95601890afd80709" },
270 {
"The quick brown fox jumps over the lazy cog",
"de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3" },
271 {
"The quick brown fox jumps over the lazy dog",
"2fd4e1c67a2d28fced849ee1bb76e7391b93eb12" } }
283 std::cout <<
"MD5 TEST\n";
287 "d41d8cd98f00b204e9800998ecf8427e" },
290 "0cc175b9c0f1b6a831c399e269772661" },
292 {
"The quick brown fox jumps over the lazy dog",
293 "9e107d9d372bb6826bd81d3542a419d6" },
295 {
"The quick brown fox jumps over the lazy dog.",
296 "e4d909c290d0fb1ca068ffaddf22cbd0" } }
Fichier de configuration d'Arcane.
Valeur retournée par un algorithme de hashage.
Interface d'un algorithme de hashage.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Calcule la fonction de hashage MD5 d'un tableau.
Implémentation de l'algorithme SHA-1.
Hash pour l'algorithme SHA-3 224.
Hash pour l'algorithme SHA-3 256.
Hash pour l'algorithme SHA-3 384.
Hash pour l'algorithme SHA-3 512.
Vue constante d'un tableau de type T.
Chaîne de caractères unicode.
Vecteur 1D de données avec sémantique par valeur (style STL).
String toHexaString(ByteConstArrayView input)
Converti un tableau d'octet en sa représentation hexadécimale.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
detail::SpanTypeFromSize< conststd::byte, SizeType >::SpanType asBytes(const SpanImpl< DataType, SizeType, Extent > &s)
Converti la vue en un tableau d'octets non modifiables.