- Accueil
- » Forum
- » Sécurité
- » [Résolu] md5
Pages : 1
#1 Le 02/10/2022, à 21:02
- denebe
[Résolu] md5
Bonjour,
je cherche un peu à comprendre comment est construit un hash md5. Je passe les détails, c'est légèrement compliqué. La source officielle est ici.
Mon soucis:
quand j'utilise md5sum, j'obtiens ceci
thierry@thierry-VirtualBox:~$ echo [b]Bonjour[/b] | md5sum 894dddf3304cbcb0fe04f7c2bbd56073 -
quand j'utilise un site quelconque pour calculer un md5, j'obtiens ceci
ebc58ab2cb4848d04ec23d83f7ddf985$returnValue = md5('Bonjour');
J'ai aussi essayé ce petit programme - ft_ssl (sur git)
Le md5 est à la fin…thierry@toto-PC:~/Téléchargements/md5_sha256-512_debugger-master> ./ft_ssl md5 -s "Bonjour" Table of constants: K[ 0]=3614090360 K[ 1]=3905402710 K[ 2]=606105819 K[ 3]=3250441966 K[ 4]=4118548399 K[ 5]=1200080426 K[ 6]=2821735955 K[ 7]=4249261313 K[ 8]=1770035416 K[ 9]=2336552879 K[10]=4294925233 K[11]=2304563134 K[12]=1804603682 K[13]=4254626195 K[14]=2792965006 K[15]=1236535329 K[16]=4129170786 K[17]=3225465664 K[18]=643717713 K[19]=3921069994 K[20]=3593408605 K[21]=38016083 K[22]=3634488961 K[23]=3889429448 K[24]=568446438 K[25]=3275163606 K[26]=4107603335 K[27]=1163531501 K[28]=2850285829 K[29]=4243563512 K[30]=1735328473 K[31]=2368359562 K[32]=4294588738 K[33]=2272392833 K[34]=1839030562 K[35]=4259657740 K[36]=2763975236 K[37]=1272893353 K[38]=4139469664 K[39]=3200236656 K[40]=681279174 K[41]=3936430074 K[42]=3572445317 K[43]=76029189 K[44]=3654602809 K[45]=3873151461 K[46]=530742520 K[47]=3299628645 K[48]=4096336452 K[49]=1126891415 K[50]=2878612391 K[51]=4237533241 K[52]=1700485571 K[53]=2399980690 K[54]=4293915773 K[55]=2240044497 K[56]=1873313359 K[57]=4264355552 K[58]=2734768916 K[59]=1309151649 K[60]=4149444226 K[61]=3174756917 K[62]=718787259 K[63]=3951481745 Table of per-round shift amounts: s[ 0]=7 s[ 1]=12 s[ 2]=17 s[ 3]=22 s[ 4]=7 s[ 5]=12 s[ 6]=17 s[ 7]=22 s[ 8]=7 s[ 9]=12 s[10]=17 s[11]=22 s[12]=7 s[13]=12 s[14]=17 s[15]=22 s[16]=5 s[17]=9 s[18]=14 s[19]=20 s[20]=5 s[21]=9 s[22]=14 s[23]=20 s[24]=5 s[25]=9 s[26]=14 s[27]=20 s[28]=5 s[29]=9 s[30]=14 s[31]=20 s[32]=4 s[33]=11 s[34]=16 s[35]=23 s[36]=4 s[37]=11 s[38]=16 s[39]=23 s[40]=4 s[41]=11 s[42]=16 s[43]=23 s[44]=4 s[45]=11 s[46]=16 s[47]=23 s[48]=6 s[49]=10 s[50]=15 s[51]=21 s[52]=6 s[53]=10 s[54]=15 s[55]=21 s[56]=6 s[57]=10 s[58]=15 s[59]=21 s[60]=6 s[61]=10 s[62]=15 s[63]=21 Initial words values: A: 1732584193 B: 4023233417 C: 2562383102 D: 271733878 -- Set memory end .../ 10000000 /... at 8 byte -- -- Set memory length=7 starting from 57 byte in little endian(least-significant element in the lowest-enumerated ("smallest numbered" or "first") position) #0 memory block binary /byte by byte/: 01000010 01101111 01101110 01101010 01101111 01110101 01110010 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00111000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 #0 memory block decimal /unsigned ints/: [ 0] 1785622338 [ 1] 2154984815 [ 2] 0 [ 3] 0 [ 4] 0 [ 5] 0 [ 6] 0 [ 7] 0 [ 8] 0 [ 9] 0 [10] 0 [11] 0 [12] 0 [13] 0 [14] 56 [15] 0 Start words values A=1732584193 B=4023233417 C=2562383102 D=271733878 Words on each permutation step: [ 0] A=3696724009 B=4023233417 C=2562383102 D=271733878 [ 1] A=3696724009 B=4023233417 C=2562383102 D=2184785038 [ 2] A=3696724009 B=4023233417 C=872317423 D=2184785038 [ 3] A=3696724009 B=4116607759 C=872317423 D=2184785038 [ 4] A=2662409873 B=4116607759 C=872317423 D=2184785038 [ 5] A=2662409873 B=4116607759 C=872317423 D=2551422594 [ 6] A=2662409873 B=4116607759 C=4147335578 D=2551422594 [ 7] A=2662409873 B=2618695593 C=4147335578 D=2551422594 [ 8] A=3200162167 B=2618695593 C=4147335578 D=2551422594 [ 9] A=3200162167 B=2618695593 C=4147335578 D=3183229309 [10] A=3200162167 B=2618695593 C=1480434014 D=3183229309 [11] A=3200162167 B=2440474026 C=1480434014 D=3183229309 [12] A=388278749 B=2440474026 C=1480434014 D=3183229309 [13] A=388278749 B=2440474026 C=1480434014 D=1013861158 [14] A=388278749 B=2440474026 C=1640985341 D=1013861158 [15] A=388278749 B=2643712349 C=1640985341 D=1013861158 [16] A=78359258 B=2643712349 C=1640985341 D=1013861158 [17] A=78359258 B=2643712349 C=1640985341 D=2583701516 [18] A=78359258 B=2643712349 C=402075681 D=2583701516 [19] A=78359258 B=483407332 C=402075681 D=2583701516 [20] A=923640195 B=483407332 C=402075681 D=2583701516 [21] A=923640195 B=483407332 C=402075681 D=3385977593 [22] A=923640195 B=483407332 C=2008232470 D=3385977593 [23] A=923640195 B=974354799 C=2008232470 D=3385977593 [24] A=510686337 B=974354799 C=2008232470 D=3385977593 [25] A=510686337 B=974354799 C=2008232470 D=2437502423 [26] A=510686337 B=974354799 C=4137842193 D=2437502423 [27] A=510686337 B=835968897 C=4137842193 D=2437502423 [28] A=953057385 B=835968897 C=4137842193 D=2437502423 [29] A=953057385 B=835968897 C=4137842193 D=1372922345 [30] A=953057385 B=835968897 C=4035575780 D=1372922345 [31] A=953057385 B=3476883808 C=4035575780 D=1372922345 [32] A=1105599210 B=3476883808 C=4035575780 D=1372922345 [33] A=1105599210 B=3476883808 C=4035575780 D=302833062 [34] A=1105599210 B=3476883808 C=1094703269 D=302833062 [35] A=1105599210 B=137352277 C=1094703269 D=302833062 [36] A=729060241 B=137352277 C=1094703269 D=302833062 [37] A=729060241 B=137352277 C=1094703269 D=2916751763 [38] A=729060241 B=137352277 C=808902671 D=2916751763 [39] A=729060241 B=2574623756 C=808902671 D=2916751763 [40] A=604807809 B=2574623756 C=808902671 D=2916751763 [41] A=604807809 B=2574623756 C=808902671 D=4039585538 [42] A=604807809 B=2574623756 C=720011750 D=4039585538 [43] A=604807809 B=3862466892 C=720011750 D=4039585538 [44] A=2242099055 B=3862466892 C=720011750 D=4039585538 [45] A=2242099055 B=3862466892 C=720011750 D=690559095 [46] A=2242099055 B=3862466892 C=1717284278 D=690559095 [47] A=2242099055 B=2518059179 C=1717284278 D=690559095 [48] A=3359198544 B=2518059179 C=1717284278 D=690559095 [49] A=3359198544 B=2518059179 C=1717284278 D=3355004991 [50] A=3359198544 B=2518059179 C=3453709591 D=3355004991 [51] A=3359198544 B=3665086258 C=3453709591 D=3355004991 [52] A=721372491 B=3665086258 C=3453709591 D=3355004991 [53] A=721372491 B=3665086258 C=3453709591 D=1874193961 [54] A=721372491 B=3665086258 C=2119366575 D=1874193961 [55] A=721372491 B=4284555780 C=2119366575 D=1874193961 [56] A=4156761802 B=4284555780 C=2119366575 D=1874193961 [57] A=4156761802 B=4284555780 C=2119366575 D=3142239395 [58] A=4156761802 B=4284555780 C=3594845020 D=3142239395 [59] A=4156761802 B=1186680650 C=3594845020 D=3142239395 [60] A=1262854890 B=1186680650 C=3594845020 D=3142239395 [61] A=1262854890 B=1186680650 C=3594845020 D=1976011137 [62] A=1262854890 B=1186680650 C=3934446928 D=1976011137 [63] A=1262854890 B=3766132034 C=3934446928 D=1976011137 Processed A=2995439083 B=3494398155 C=2201862734 D=2247745015 Results in hex and concatenate final results: A: b28ac5eb converting to ebc58ab2 B: d04848cb converting to cb4848d0 C: 833dc24e converting to 4ec23d83 D: 85f9ddf7 converting to f7ddf985 MD5 ("Bonjour") = ebc58ab2cb4848d04ec23d83f7ddf985
Question:
Pourquoi md5sum me donne 894dddf3304cbcb0fe04f7c2bbd56073 comme valeur md5 pour "Bonjour", alors que https://www.functions-online.com/md5.html ainsi que le logiciel ft_ssl me donne ebc58ab2cb4848d04ec23d83f7ddf985 ?
Merci pour votre aide.
Dernière modification par denebe (Le 02/10/2022, à 21:47)
Opensuse Leap 15.6, Ubuntu 24.04
Dimensions Moebius transf.
Sésamath
Hors ligne
#2 Le 02/10/2022, à 21:09
- Watael
Re : [Résolu] md5
la différence, c'est le retour à la ligne qu'ajoute* echo :
echo Bonjour | md5sum
894dddf3304cbcb0fe04f7c2bbd56073 -
$ echo -n Bonjour | md5sum
ebc58ab2cb4848d04ec23d83f7ddf985 -
$ printf '%s' Bonjour | md5sum
ebc58ab2cb4848d04ec23d83f7ddf985 -
$
--
*
$ echo -n Bonjour | wc -m
7
$ echo Bonjour | wc -m
8
$
Dernière modification par Watael (Le 02/10/2022, à 21:11)
Connected \o/
Welcome to sHell. · eval is evil.
Hors ligne
#3 Le 02/10/2022, à 21:46
- denebe
Re : [Résolu] md5
Le fameux retour à la ligne, le caractère invisible qui peut faire perdre un temps certain, voir un certain temps…
Merci pour ton aide
Opensuse Leap 15.6, Ubuntu 24.04
Dimensions Moebius transf.
Sésamath
Hors ligne
Pages : 1