forked from greendow/Hash-DRBG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_data_1.txt
318 lines (280 loc) · 10.1 KB
/
test_data_1.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
The following data are used in function 'test_sha256_hash_drbg_without_prediction_resistance( )'. They are excerpted from the document provided by NIST. The document can be downloaded from: https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/Hash_DRBG.pdf
Page 215.-- 225.
##############################################################
Hash_DRBG
Requested Security Strength = 128
Requested Hash Algorithm = SHA-256
prediction_resistance_flag = "NOT ENABLED"
EntropyInput =
000102 03040506
0708090A 0B0C0D0E 0F101112 13141516 1718191A 1B1C1D1E
1F202122 23242526 2728292A 2B2C2D2E 2F303132 33343536
EntropyInput1 (for Reseed1) =
808182 83848586
8788898A 8B8C8D8E 8F909192 93949596 9798999A 9B9C9D9E
9FA0A1A2 A3A4A5A6 A7A8A9AA ABACADAE AFB0B1B2 B3B4B5B6
EntropyInput2 (for Reseed2) =
C0C1C2 C3C4C5C6
C7C8C9CA CBCCCDCE CFD0D1D2 D3D4D5D6 D7D8D9DA DBDCDDDE
DFE0E1E2 E3E4E5E6 E7E8E9EA EBECEDEE EFF0F1F2 F3F4F5F6
Nonce =
20212223 24252627
PersonalizationString =
404142 43444546
4748494A 4B4C4D4E 4F505152 53545556 5758595A 5B5C5D5E
5F606162 63646566 6768696A 6B6C6D6E 6F707172 73747576
AdditionalInput1 =
606162 63646566
6768696A 6B6C6D6E 6F707172 73747576 7778797A 7B7C7D7E
7F808182 83848586 8788898A 8B8C8D8E 8F909192 93949596
AdditionalInput2 =
A0A1A2 A3A4A5A6
A7A8A9AA ABACADAE AFB0B1B2 B3B4B5B6 B7B8B9BA BBBCBDBE
BFC0C1C2 C3C4C5C6 C7C8C9CA CBCCCDCE CFD0D1D2 D3D4D5D6
###########################################################
**************************************************************
Hash_DRBG_Instantiate_algorithm
entropy_input is
000102 03040506
0708090A 0B0C0D0E 0F101112 13141516 1718191A 1B1C1D1E
1F202122 23242526 2728292A 2B2C2D2E 2F303132 33343536
nonce is
20212223 24252627
personal_str is
404142 43444546
4748494A 4B4C4D4E 4F505152 53545556 5758595A 5B5C5D5E
5F606162 63646566 6768696A 6B6C6D6E 6F707172 73747576
prediction_resistance_flag = "No PredictionResistance"
Hash_df - Generate seed(which is V) - Step 2
seed_material is
0001 02030405 06070809 0A0B0C0D 0E0F1011 12131415
16171819 1A1B1C1D 1E1F2021 22232425 26272829 2A2B2C2D
2E2F3031 32333435 36202122 23242526 27404142 43444546
4748494A 4B4C4D4E 4F505152 53545556 5758595A 5B5C5D5E
5F606162 63646566 6768696A 6B6C6D6E 6F707172 73747576
no_of_bits_to_return = 440
------------
i = 1
counter||no_of_bits_to_return||input_string is
010000
01B80001 02030405 06070809 0A0B0C0D 0E0F1011 12131415
16171819 1A1B1C1D 1E1F2021 22232425 26272829 2A2B2C2D
2E2F3031 32333435 36202122 23242526 27404142 43444546
4748494A 4B4C4D4E 4F505152 53545556 5758595A 5B5C5D5E
5F606162 63646566 6768696A 6B6C6D6E 6F707172 73747576
Hash(counter||no_of_bits_to_return||input_string) is
A3E94E39 26FDA169
C303D664 383905E0 D79962D1 65446D63 BDA654D1 32F72DB4
temp =
A3E94E39 26FDA169
C303D664 383905E0 D79962D1 65446D63 BDA654D1 32F72DB4
------------
i = 2
counter||no_of_bits_to_return||input_string is
020000
01B80001 02030405 06070809 0A0B0C0D 0E0F1011 12131415
16171819 1A1B1C1D 1E1F2021 22232425 26272829 2A2B2C2D
2E2F3031 32333435 36202122 23242526 27404142 43444546
4748494A 4B4C4D4E 4F505152 53545556 5758595A 5B5C5D5E
5F606162 63646566 6768696A 6B6C6D6E 6F707172 73747576
Hash(counter||no_of_bits_to_return||input_string) is
71564B45 6FF2EEC8
36422ACC 5A029935 A7992990 94A1CA74 1B916DC0 26A7E107
temp =
A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D 63BDA654 D132F72D
B471564B 456FF2EE C836422A CC5A0299 35A79929 9094A1CA
V is
A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D 63BDA654 D132F72D
B471564B 456FF2EE C836422A CC5A0299 35A79929 9094A1CA
---------------------------
Hash_df - Generate C - Step 4
0x00||V is
00A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D 63BDA654 D132F72D
B471564B 456FF2EE C836422A CC5A0299 35A79929 9094A1CA
no_of_bits_to_return = 440
------------
i = 1
counter||no_of_bits_to_return||input_string is
01 000001B8 00A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D 63BDA654 D132F72D
B471564B 456FF2EE C836422A CC5A0299 35A79929 9094A1CA
Hash(counter||no_of_bits_to_return||input_string) is
44748A78 B16E7555
9F881D51 C15DFE6C 52CFB0BB 71620169 C7933427 67E7F887
temp =
44748A78 B16E7555
9F881D51 C15DFE6C 52CFB0BB 71620169 C7933427 67E7F887
------------
i = 2
counter||no_of_bits_to_return||input_string is
02 000001B8 00A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D 63BDA654 D132F72D
B471564B 456FF2EE C836422A CC5A0299 35A79929 9094A1CA
Hash(counter||no_of_bits_to_return||input_string) is
5F42CB6A 20C89D7C
6EF3DC61 0D8FF203 D6766CED 1919D094 ED485EF7 FADDB668
temp =
44748A 78B16E75
559F881D 51C15DFE 6C52CFB0 BB716201 69C79334 2767E7F8
875F42CB 6A20C89D 7C6EF3DC 610D8FF2 03D6766C ED1919D0
--------------------------------------------------------------
C is
44748A 78B16E75
559F881D 51C15DFE 6C52CFB0 BB716201 69C79334 2767E7F8
875F42CB 6A20C89D 7C6EF3DC 610D8FF2 03D6766C ED1919D0
First call to Generate
**************************************************************
---------------------------
Hash_DRBG_Generate_algorithm
requested_number_of_bits = 512
additional_input
606162 63646566
6768696A 6B6C6D6E 6F707172 73747576 7778797A 7B7C7D7E
7F808182 83848586 8788898A 8B8C8D8E 8F909192 93949596
---------------------------
Process additional_input
0x02||V||additional_input is
02A3E9 4E3926FD A169C303 D6643839
05E0D799 62D16544 6D63BDA6 54D132F7 2DB47156 4B456FF2
EEC83642 2ACC5A02 9935A799 299094A1 CA606162 63646566
6768696A 6B6C6D6E 6F707172 73747576 7778797A 7B7C7D7E
7F808182 83848586 8788898A 8B8C8D8E 8F909192 93949596
w=Hash(0x02||V||additional_input) is
3CBE9AC4 CEFC9E53
84B05F3A 13305C81 BB347128 578D087A D9CD6168 A7BBD90A
--------------------------
V is
A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D A07C4119 A02F9581
3921B585 58A04F70 836AB353 23E70B14 0F74FA92 38507AD4
Hashgen
requested_no_of_bits = 512
------------
i = 1
data is
A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D A07C4119 A02F9581
3921B585 58A04F70 836AB353 23E70B14 0F74FA92 38507AD4
w_i is
E0B97C82 1268FD3B
B2CABFD1 F9548478 AE8A6041 7F7B094A 26139546 062B521C
W is
E0B97C82 1268FD3B
B2CABFD1 F9548478 AE8A6041 7F7B094A 26139546 062B521C
------------
i = 2
data is
A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D A07C4119 A02F9581
3921B585 58A04F70 836AB353 23E70B14 0F74FA92 38507AD5
w_i is
FD33E4E3 9B9DCD0A
3DA15209 C72ADBE5 8C20AB34 07026951 297AD254 307553A5
W is
E0B97C82 1268FD3B B2CABFD1 F9548478
AE8A6041 7F7B094A 26139546 062B521C FD33E4E3 9B9DCD0A
3DA15209 C72ADBE5 8C20AB34 07026951 297AD254 307553A5
---------------------------
returned_bits is
E0B97C82 1268FD3B B2CABFD1 F9548478
AE8A6041 7F7B094A 26139546 062B521C FD33E4E3 9B9DCD0A
3DA15209 C72ADBE5 8C20AB34 07026951 297AD254 307553A5
Update V
0x03||V is
03A3E94E 3926FDA1
69C303D6 64383905 E0D79962 D165446D A07C4119 A02F9581
3921B585 58A04F70 836AB353 23E70B14 0F74FA92 38507AD4
H is
8264A739 7BB8A2B4
5D09B864 EA8694B4 75668170 5EB44819 680AE7DE AC2CFFE4
Updated values
V is
E85DD8 B1D86C16
BF628BF3 B5F99704 4D2A6913 8CD6A66F 8CA87B87 4350202E
1D8AB0B5 AD47ACC2 7540289F E3A8E31F 7B5658DD D1969489
reseed_counter is
0000 00000002
rnd_val is
E0B97C82 1268FD3B B2CABFD1 F9548478
AE8A6041 7F7B094A 26139546 062B521C FD33E4E3 9B9DCD0A
3DA15209 C72ADBE5 8C20AB34 07026951 297AD254 307553A5
--------------------------------------------------------------
Second call to Generate
**************************************************************
Hash_DRBG_Generate_algorithm
requested_number_of_bits = 512
additional_input
A0A1A2 A3A4A5A6
A7A8A9AA ABACADAE AFB0B1B2 B3B4B5B6 B7B8B9BA BBBCBDBE
BFC0C1C2 C3C4C5C6 C7C8C9CA CBCCCDCE CFD0D1D2 D3D4D5D6
---------------------------
---------------------------
Process additional_input
0x02||V||additional_input is
02E85D D8B1D86C 16BF628B F3B5F997
044D2A69 138CD6A6 6F8CA87B 87435020 2E1D8AB0 B5AD47AC
C2754028 9FE3A8E3 1F7B5658 DDD19694 89A0A1A2 A3A4A5A6
A7A8A9AA ABACADAE AFB0B1B2 B3B4B5B6 B7B8B9BA BBBCBDBE
BFC0C1C2 C3C4C5C6 C7C8C9CA CBCCCDCE CFD0D1D2 D3D4D5D6
w=Hash(0x02||V||additional_input) is
A2701C07 02B8A337
615E949D 0B86D42B 002EF072 58584377 ECBF1094 62AFC8AC
V is
E85DD8 B1D86C16
BF628BF3 B5F99704 4D2A6913 8CD6A670 2F18978E 4608C365
7EE94552 B8CE80ED 756F1912 3C012697 68156972 34465D35
Hashgen
requested_no_of_bits = 512
------------
i = 1
data is
E85DD8 B1D86C16
BF628BF3 B5F99704 4D2A6913 8CD6A670 2F18978E 4608C365
7EE94552 B8CE80ED 756F1912 3C012697 68156972 34465D35
w_i is
C1ACD3AD A4C8C495
BF179DB5 9822C351 BC479ABE 4EB28F84 3957B11E 3C2BC048
W is
C1ACD3AD A4C8C495
BF179DB5 9822C351 BC479ABE 4EB28F84 3957B11E 3C2BC048
------------
i = 2
data is
E85DD8 B1D86C16
BF628BF3 B5F99704 4D2A6913 8CD6A670 2F18978E 4608C365
7EE94552 B8CE80ED 756F1912 3C012697 68156972 34465D36
w_i is
83964297 975BD72D
1024ABCF 6F6615D7 F5B4FD1E 40A64EEB 45BA2181 B83937ED
W is
C1ACD3AD A4C8C495 BF179DB5 9822C351
BC479ABE 4EB28F84 3957B11E 3C2BC048 83964297 975BD72D
1024ABCF 6F6615D7 F5B4FD1E 40A64EEB 45BA2181 B83937ED
returned_bits is
C1ACD3AD A4C8C495 BF179DB5 9822C351
BC479ABE 4EB28F84 3957B11E 3C2BC048 83964297 975BD72D
1024ABCF 6F6615D7 F5B4FD1E 40A64EEB 45BA2181 B83937ED
---------------------------
Update V
0x03||V is
03E85DD8 B1D86C16
BF628BF3 B5F99704 4D2A6913 8CD6A670 2F18978E 4608C365
7EE94552 B8CE80ED 756F1912 3C012697 68156972 34465D35
H is
19978405 921CF6DE
6BA76D7F 9F5F14C1 8D7A3AC2 2420B3D0 327F4EFB 9ED0F4C6
Updated values
V is
2CD263 2A89DA8C
15021411 07BAF502 B97D38C4 48480871 B277AEC7 FF8DA23C
71EFF59D C24E5E4C 7F5847B0 C12F6A59 9E6B2EDA C0306BCD
reseed_counter is
0000 00000003
rnd_val is
C1ACD3AD A4C8C495 BF179DB5 9822C351
BC479ABE 4EB28F84 3957B11E 3C2BC048 83964297 975BD72D
1024ABCF 6F6615D7 F5B4FD1E 40A64EEB 45BA2181 B83937ED
##############################################################