PRNG à base de SHA-512 ?

Le
Philippe Lheureux
Le logiciel de chiffrement par flot HMK visible sur la page
http://hmk2012.franceserv.com/
utilise la méthode suivante pour la construction du masque

Hash1=SHA-512(clé + vecteur d'initialisation)
Hash2=SHA-512(Hash1+clé)
Hash3=SHA-512(Hash2+clé)
et ainsi de suite !
on lit ensuite les chaines hexadécimale par série de deux caractères =
, le premier correspondant à la rangée et le deuxième à la colonne =
d'une table ASCII pour obtenir le masque définitif.

Passé ensuite dans ENT.exe on obtient des résultats qui semblent vraime=
nt très proche de l'aléatoire.

-- TEST 1 --

Value Char Occurrences Fraction
0 41121 0.003922
1 41058 0.003916
2 41225 0.003932
3 40706 0.003882
4 40941 0.003904
5 41016 0.003912
6 40933 0.003904
7 41466 0.003955
8 41098 0.003919
9 40798 0.003891
10 40945 0.003905
11 40965 0.003907
12 40823 0.003893
13 41003 0.003910
14 40744 0.003886
15 41025 0.003912
16 40989 0.003909
17 40981 0.003908
18 40976 0.003908
19 41185 0.003928
20 40773 0.003888
21 40857 0.003896
22 40984 0.003909
23 40908 0.003901
24 40926 0.003903
25 41102 0.003920
26 40672 0.003879
27 40693 0.003881
28 41348 0.003943
29 41207 0.003930
30 40825 0.003893
31 41053 0.003915
32 41057 0.003916
33 ! 41096 0.003919
34 " 40804 0.003891
35 # 40736 0.003885
36 $ 40938 0.003904
37 % 40878 0.003898
38 & 41170 0.003926
39 ' 40901 0.003901
40 ( 40772 0.003888
41 ) 41159 0.003925
42 * 41127 0.003922
43 + 40919 0.003902
44 , 41078 0.003918
45 - 41056 0.003915
46 . 41116 0.003921
47 / 40598 0.003872
48 0 40985 0.003909
49 1 40875 0.003898
50 2 40571 0.003869
51 3 40742 0.003885
52 4 41279 0.003937
53 5 41325 0.003941
54 6 41186 0.003928
55 7 40937 0.003904
56 8 41082 0.003918
57 9 41204 0.003930
58 : 40876 0.003898
59 ; 40739 0.003885
60 < 40687 0.003880
61 = 40896 0.003900
62 > 41238 0.003933
63 ? 40841 0.003895
64 @ 40634 0.003875
65 A 40726 0.003884
66 B 41428 0.003951
67 C 40929 0.003903
68 D 40642 0.003876
69 E 41215 0.003931
70 F 40742 0.003885
71 G 40709 0.003882
72 H 40640 0.003876
73 I 40934 0.003904
74 J 40724 0.003884
75 K 41029 0.003913
76 L 41075 0.003917
77 M 41000 0.003910
78 N 41093 0.003919
79 O 40809 0.003892
80 P 40600 0.003872
81 Q 40953 0.003906
82 R 41035 0.003913
83 S 40804 0.003891
84 T 40909 0.003901
85 U 40887 0.003899
86 V 40922 0.003903
87 W 40967 0.003907
88 X 41303 0.003939
89 Y 41011 0.003911
90 Z 41437 0.003952
91 [ 41211 0.003930
92 40934 0.003904
93 ] 40780 0.003889
94 ^ 40879 0.003899
95 _ 41112 0.003921
96 ` 41086 0.003918
97 a 40889 0.003899
98 b 40728 0.003884
99 c 40869 0.003898
100 d 41367 0.003945
101 e 41153 0.003925
102 f 41060 0.003916
103 g 40877 0.003898
104 h 40763 0.003887
105 i 40734 0.003885
106 j 40757 0.003887
107 k 41074 0.003917
108 l 40848 0.003896
109 m 41159 0.003925
110 n 41161 0.003925
111 o 41375 0.003946
112 p 41141 0.003924
113 q 41225 0.003932
114 r 40993 0.003909
115 s 41359 0.003944
116 t 41050 0.003915
117 u 40843 0.003895
118 v 41133 0.003923
119 w 40799 0.003891
120 x 41218 0.003931
121 y 40950 0.003905
122 z 41026 0.003913
123 { 41447 0.003953
124 | 41249 0.003934
125 } 40779 0.003889
126 ~ 41274 0.003936
127 41036 0.003913
128 41069 0.003917
129 40897 0.003900
130 41088 0.003918
131 40883 0.003899
132 41023 0.003912
133 41224 0.003931
134 41146 0.003924
135 40902 0.003901
136 41049 0.003915
137 40916 0.003902
138 40828 0.003894
139 40592 0.003871
140 41011 0.003911
141 41048 0.003915
142 41419 0.003950
143 40854 0.003896
144 40900 0.003901
145 40731 0.003884
146 40979 0.003908
147 41011 0.003911
148 40922 0.003903
149 40806 0.003892
150 41064 0.003916
151 40902 0.003901
152 40806 0.003892
153 41123 0.003922
154 41034 0.003913
155 40986 0.003909
156 41354 0.003944
157 40982 0.003908
158 41081 0.003918
159 41015 0.003911
160 41077 0.003917
161 ¡ 40836 0.003894
162 ¢ 41006 0.003911
163 £ 40762 0.003887
164 ¤ 40603 0.003872
165 ¥ 40775 0.003889
166 ¦ 40896 0.003900
167 § 40611 0.003873
168 ¨ 40516 0.003864
169 © 41030 0.003913
170 ª 41008 0.003911
171 « 40828 0.003894
172 ¬ 40858 0.003897
173 ­ 41122 0.003922
174 ® 41411 0.003949
175 ¯ 41032 0.003913
176 ° 41178 0.003927
177 ± 41046 0.003914
178 ² 40990 0.003909
179 ³ 40922 0.003903
180 ´ 40894 0.003900
181 µ 40655 0.003877
182 ¶ 41150 0.003924
183 · 41086 0.003918
184 ¸ 40791 0.003890
185 ¹ 40836 0.003894
186 º 40833 0.003894
187 » 40985 0.003909
188 ¼ 40993 0.003909
189 ½ 40889 0.003899
190 ¾ 40756 0.003887
191 ¿ 40737 0.003885
192 À 41110 0.003921
193 Á 40964 0.003907
194 Â 40832 0.003894
195 Ã 40419 0.003855
196 Ä 41022 0.003912
197 Å 41055 0.003915
198 Æ 40868 0.003897
199 Ç 40793 0.003890
200 È 40899 0.003900
201 É 40852 0.003896
202 Ê 40784 0.003889
203 Ë 40868 0.003897
204 Ì 41001 0.003910
205 Í 41064 0.003916
206 Î 40877 0.003898
207 Ï 41156 0.003925
208 Ð 40745 0.003886
209 Ñ 40532 0.003865
210 Ò 40652 0.003877
211 Ó 40883 0.003899
212 Ô 40934 0.003904
213 Õ 40864 0.003897
214 Ö 40784 0.003889
215 × 41052 0.003915
216 Ø 41017 0.003912
217 Ù 41333 0.003942
218 Ú 40763 0.003887
219 Û 41007 0.003911
220 Ü 40808 0.003892
221 Ý 40712 0.003883
222 Þ 41056 0.003915
223 ß 40789 0.003890
224 à 40813 0.003892
225 á 40869 0.003898
226 â 41219 0.003931
227 ã 40544 0.003867
228 ä 40987 0.003909
229 å 41114 0.003921
230 æ 40829 0.003894
231 ç 40996 0.003910
232 è 41173 0.003927
233 é 40870 0.003898
234 ê 41056 0.003915
235 ë 41225 0.003932
236 ì 40691 0.003881
237 í 41125 0.003922
238 î 40866 0.003897
239 ï 41273 0.003936
240 ð 41089 0.003919
241 ñ 40506 0.003863
242 ò 40930 0.003903
243 ó 40681 0.003880
244 ô 40838 0.003895
245 õ 40836 0.003894
246 ö 41048 0.003915
247 ÷ 41060 0.003916
248 ø 41142 0.003924
249 ù 41284 0.003937
250 ú 40654 0.003877
251 û 40759 0.003887
252 ü 40919 0.003902
253 ý 41179 0.003927
254 þ 41293 0.003938
255 ÿ 40931 0.003903

Total: 10485760 1.000000

Entropy = 7.999983 bits per byte.

Optimum compression would reduce the size
of this 10485760 byte file by 0 percent.

Chi square distribution for 10485760 samples is 245.96, and randomly
would exceed this value 64.64 percent of the times.

Arithmetic mean value of data bytes is 127.4732 (127.5 = random).
Monte Carlo value for Pi is 3.140848214 (error 0.02 percent).
Serial correlation coefficient is 0.000044 (totally uncorrelated = 0.0).


-- TEST 2 --

Entropy = 1.000000 bits per bit.

Optimum compression would reduce the size
of this 83886080 bit file by 0 percent.

Chi square distribution for 83886080 samples is 0.36, and randomly
would exceed this value 54.73 percent of the times.

Arithmetic mean value of data bits is 0.5000 (0.5 = random).
Monte Carlo value for Pi is 3.140848214 (error 0.02 percent).
Serial correlation coefficient is 0.000137 (totally uncorrelated = 0.0).


-- TEST 3 --

Value Char Occurrences Fraction
0 41940284 0.499967
1 41945796 0.500033

Total: 83886080 1.000000

Entropy = 1.000000 bits per bit.

Optimum compression would reduce the size
of this 83886080 bit file by 0 percent.

Chi square distribution for 83886080 samples is 0.36, and randomly
would exceed this value 54.73 percent of the times.

Arithmetic mean value of data bits is 0.5000 (0.5 = random).
Monte Carlo value for Pi is 3.140848214 (error 0.02 percent).
Serial correlation coefficient is 0.000137 (totally uncorrelated = 0.0).

A chaque fois qu'on test , on obtient des résultats très bons d'où la=
question , ou est la faille dans ce genre de PRNG ?
Vidéos High-Tech et Jeu Vidéo
Téléchargements
Vos réponses
Gagnez chaque mois un abonnement Premium avec GNT : Inscrivez-vous !
Trier par : date / pertinence
Philippe Lheureux
Le #25680122
Un autre exemple avec un autre fichier généré

----------- TEST 1 -----------

Value Char Occurrences Fraction
0 41070 0.003917
1 41075 0.003917
2 40675 0.003879
3 40897 0.003900
4 40981 0.003908
5 41044 0.003914
6 40835 0.003894
7 40621 0.003874
8 41085 0.003918
9 41088 0.003918
10 41076 0.003917
11 40683 0.003880
12 41004 0.003910
13 40867 0.003897
14 40776 0.003889
15 40770 0.003888
16 41276 0.003936
17 41386 0.003947
18 41188 0.003928
19 40963 0.003907
20 40653 0.003877
21 41085 0.003918
22 40965 0.003907
23 41297 0.003938
24 41203 0.003929
25 40653 0.003877
26 41079 0.003918
27 40733 0.003885
28 41165 0.003926
29 40900 0.003901
30 40883 0.003899
31 40995 0.003910
32 41283 0.003937
33 ! 40969 0.003907
34 " 40950 0.003905
35 # 40698 0.003881
36 $ 41293 0.003938
37 % 41194 0.003929
38 & 41366 0.003945
39 ' 41047 0.003915
40 ( 40815 0.003892
41 ) 40917 0.003902
42 * 40931 0.003903
43 + 40712 0.003883
44 , 40700 0.003881
45 - 41112 0.003921
46 . 40918 0.003902
47 / 41036 0.003913
48 0 40863 0.003897
49 1 41127 0.003922
50 2 41178 0.003927
51 3 41207 0.003930
52 4 40881 0.003899
53 5 40971 0.003907
54 6 40898 0.003900
55 7 40941 0.003904
56 8 41319 0.003940
57 9 40739 0.003885
58 : 40862 0.003897
59 ; 40910 0.003901
60 < 40965 0.003907
61 = 40870 0.003898
62 > 40720 0.003883
63 ? 40830 0.003894
64 @ 40944 0.003905
65 A 40895 0.003900
66 B 40785 0.003890
67 C 41182 0.003927
68 D 40866 0.003897
69 E 41037 0.003914
70 F 40901 0.003901
71 G 40806 0.003892
72 H 41368 0.003945
73 I 41026 0.003913
74 J 40967 0.003907
75 K 40707 0.003882
76 L 40764 0.003888
77 M 40903 0.003901
78 N 40690 0.003881
79 O 40916 0.003902
80 P 41003 0.003910
81 Q 40969 0.003907
82 R 40831 0.003894
83 S 40865 0.003897
84 T 41189 0.003928
85 U 41390 0.003947
86 V 40901 0.003901
87 W 40902 0.003901
88 X 41264 0.003935
89 Y 41054 0.003915
90 Z 40914 0.003902
91 [ 41042 0.003914
92 40977 0.003908
93 ] 40914 0.003902
94 ^ 40767 0.003888
95 _ 41166 0.003926
96 ` 40529 0.003865
97 a 41115 0.003921
98 b 40979 0.003908
99 c 40986 0.003909
100 d 40841 0.003895
101 e 40828 0.003894
102 f 40980 0.003908
103 g 40677 0.003879
104 h 40622 0.003874
105 i 40717 0.003883
106 j 41122 0.003922
107 k 41204 0.003930
108 l 40965 0.003907
109 m 40929 0.003903
110 n 41215 0.003931
111 o 41026 0.003913
112 p 40603 0.003872
113 q 40963 0.003907
114 r 40745 0.003886
115 s 40832 0.003894
116 t 40680 0.003880
117 u 41240 0.003933
118 v 40722 0.003884
119 w 40386 0.003852
120 x 40867 0.003897
121 y 40818 0.003893
122 z 41260 0.003935
123 { 40837 0.003895
124 | 41320 0.003941
125 } 40878 0.003898
126 ~ 40773 0.003888
127 41025 0.003912
128 40667 0.003878
129 40851 0.003896
130 41158 0.003925
131 40973 0.003907
132 40689 0.003880
133 41149 0.003924
134 40744 0.003886
135 41125 0.003922
136 40682 0.003880
137 40994 0.003909
138 40747 0.003886
139 41016 0.003912
140 41093 0.003919
141 41002 0.003910
142 41034 0.003913
143 41354 0.003944
144 40729 0.003884
145 41251 0.003934
146 41314 0.003940
147 40755 0.003887
148 41184 0.003928
149 40885 0.003899
150 41153 0.003925
151 41202 0.003929
152 41226 0.003932
153 41517 0.003959
154 40959 0.003906
155 41058 0.003916
156 40677 0.003879
157 40918 0.003902
158 40640 0.003876
159 41011 0.003911
160 41058 0.003916
161 ¡ 40605 0.003872
162 ¢ 40479 0.003860
163 £ 40506 0.003863
164 ¤ 41198 0.003929
165 ¥ 41133 0.003923
166 ¦ 41267 0.003936
167 § 41080 0.003918
168 ¨ 41176 0.003927
169 © 40708 0.003882
170 ª 41081 0.003918
171 « 41344 0.003943
172 ¬ 40753 0.003887
173 ­ 40687 0.003880
174 ® 41030 0.003913
175 ¯ 40946 0.003905
176 ° 41093 0.003919
177 ± 40761 0.003887
178 ² 41220 0.003931
179 ³ 41592 0.003967
180 ´ 41013 0.003911
181 µ 41255 0.003934
182 ¶ 40928 0.003903
183 · 41159 0.003925
184 ¸ 41219 0.003931
185 ¹ 41063 0.003916
186 º 41228 0.003932
187 » 41199 0.003929
188 ¼ 40868 0.003897
189 ½ 41230 0.003932
190 ¾ 41005 0.003911
191 ¿ 40863 0.003897
192 À 40861 0.003897
193 Á 41053 0.003915
194 Â 41197 0.003929
195 Ã 40755 0.003887
196 Ä 41241 0.003933
197 Å 41174 0.003927
198 Æ 40821 0.003893
199 Ç 41263 0.003935
200 È 41064 0.003916
201 É 41052 0.003915
202 Ê 40568 0.003869
203 Ë 41156 0.003925
204 Ì 41274 0.003936
205 Í 41098 0.003919
206 Î 41154 0.003925
207 Ï 40935 0.003904
208 Ð 40795 0.003891
209 Ñ 40826 0.003893
210 Ò 40943 0.003905
211 Ó 41158 0.003925
212 Ô 40633 0.003875
213 Õ 40929 0.003903
214 Ö 40833 0.003894
215 × 40886 0.003899
216 Ø 41063 0.003916
217 Ù 40775 0.003889
218 Ú 40902 0.003901
219 Û 40961 0.003906
220 Ü 40932 0.003904
221 Ý 40758 0.003887
222 Þ 40930 0.003903
223 ß 40795 0.003891
224 à 40728 0.003884
225 á 40735 0.003885
226 â 40815 0.003892
227 ã 41163 0.003926
228 ä 40925 0.003903
229 å 41101 0.003920
230 æ 41324 0.003941
231 ç 40871 0.003898
232 è 40645 0.003876
233 é 41055 0.003915
234 ê 40692 0.003881
235 ë 40849 0.003896
236 ì 40994 0.003909
237 í 41078 0.003918
238 î 40984 0.003909
239 ï 40428 0.003856
240 ð 40907 0.003901
241 ñ 40555 0.003868
242 ò 40675 0.003879
243 ó 40852 0.003896
244 ô 41260 0.003935
245 õ 40717 0.003883
246 ö 40512 0.003864
247 ÷ 41097 0.003919
248 ø 41055 0.003915
249 ù 41017 0.003912
250 ú 40920 0.003902
251 û 40824 0.003893
252 ü 40843 0.003895
253 ý 41113 0.003921
254 þ 40878 0.003898
255 ÿ 41077 0.003917

Total: 10485760 1.000000

Entropy = 7.999981 bits per byte.

Optimum compression would reduce the size
of this 10485760 byte file by 0 percent.

Chi square distribution for 10485760 samples is 278.52, and randomly
would exceed this value 14.91 percent of the times.

Arithmetic mean value of data bytes is 127.4874 (127.5 = random).
Monte Carlo value for Pi is 3.144528635 (error 0.09 percent).
Serial correlation coefficient is -0.000274 (totally uncorrelated = 0.0).


----------- TEST 2 -----------

Entropy = 1.000000 bits per bit.

Optimum compression would reduce the size
of this 83886080 bit file by 0 percent.

Chi square distribution for 83886080 samples is 0.56, and randomly
would exceed this value 45.39 percent of the times.

Arithmetic mean value of data bits is 0.5000 (0.5 = random).
Monte Carlo value for Pi is 3.144528635 (error 0.09 percent).
Serial correlation coefficient is -0.000159 (totally uncorrelated = 0.0).


----------- TEST 3 -----------

Value Char Occurrences Fraction
0 41946470 0.500041
1 41939610 0.499959

Total: 83886080 1.000000

Entropy = 1.000000 bits per bit.

Optimum compression would reduce the size
of this 83886080 bit file by 0 percent.

Chi square distribution for 83886080 samples is 0.56, and randomly
would exceed this value 45.39 percent of the times.

Arithmetic mean value of data bits is 0.5000 (0.5 = random).
Monte Carlo value for Pi is 3.144528635 (error 0.09 percent).
Serial correlation coefficient is -0.000159 (totally uncorrelated = 0.0).
Publicité
Poster une réponse
Anonyme