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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
//======================================================================
//
// sha512_k_constants.v
// --------------------
// The table K with constants in the SHA-512 hash function.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2014, NORDUnet A/S
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// - Neither the name of the NORDUnet nor the names of its contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//======================================================================
module sha512_k_constants(
input wire [6 : 0] addr,
output wire [63 : 0] K
);
//----------------------------------------------------------------
// Wires.
//----------------------------------------------------------------
reg [63 : 0] tmp_K;
//----------------------------------------------------------------
// Concurrent connectivity for ports etc.
//----------------------------------------------------------------
assign K = tmp_K;
//----------------------------------------------------------------
// addr_mux
//----------------------------------------------------------------
always @*
begin : addr_mux
case(addr)
0:
begin
tmp_K = 64'h428a2f98d728ae22;
end
1:
begin
tmp_K = 64'h7137449123ef65cd;
end
2:
begin
tmp_K = 64'hb5c0fbcfec4d3b2f;
end
3:
begin
tmp_K = 64'he9b5dba58189dbbc;
end
4:
begin
tmp_K = 64'h3956c25bf348b538;
end
5:
begin
tmp_K = 64'h59f111f1b605d019;
end
6:
begin
tmp_K = 64'h923f82a4af194f9b;
end
7:
begin
tmp_K = 64'hab1c5ed5da6d8118;
end
8:
begin
tmp_K = 64'hd807aa98a3030242;
end
9:
begin
tmp_K = 64'h12835b0145706fbe;
end
10:
begin
tmp_K = 64'h243185be4ee4b28c;
end
11:
begin
tmp_K = 64'h550c7dc3d5ffb4e2;
end
12:
begin
tmp_K = 64'h72be5d74f27b896f;
end
13:
begin
tmp_K = 64'h80deb1fe3b1696b1;
end
14:
begin
tmp_K = 64'h9bdc06a725c71235;
end
15:
begin
tmp_K = 64'hc19bf174cf692694;
end
16:
begin
tmp_K = 64'he49b69c19ef14ad2;
end
17:
begin
tmp_K = 64'hefbe4786384f25e3;
end
18:
begin
tmp_K = 64'h0fc19dc68b8cd5b5;
end
19:
begin
tmp_K = 64'h240ca1cc77ac9c65;
end
20:
begin
tmp_K = 64'h2de92c6f592b0275;
end
21:
begin
tmp_K = 64'h4a7484aa6ea6e483;
end
22:
begin
tmp_K = 64'h5cb0a9dcbd41fbd4;
end
23:
begin
tmp_K = 64'h76f988da831153b5;
end
24:
begin
tmp_K = 64'h983e5152ee66dfab;
end
25:
begin
tmp_K = 64'ha831c66d2db43210;
end
26:
begin
tmp_K = 64'hb00327c898fb213f;
end
27:
begin
tmp_K = 64'hbf597fc7beef0ee4;
end
28:
begin
tmp_K = 64'hc6e00bf33da88fc2;
end
29:
begin
tmp_K = 64'hd5a79147930aa725;
end
30:
begin
tmp_K = 64'h06ca6351e003826f;
end
31:
begin
tmp_K = 64'h142929670a0e6e70;
end
32:
begin
tmp_K = 64'h27b70a8546d22ffc;
end
33:
begin
tmp_K = 64'h2e1b21385c26c926;
end
34:
begin
tmp_K = 64'h4d2c6dfc5ac42aed;
end
35:
begin
tmp_K = 64'h53380d139d95b3df;
end
36:
begin
tmp_K = 64'h650a73548baf63de;
end
37:
begin
tmp_K = 64'h766a0abb3c77b2a8;
end
38:
begin
tmp_K = 64'h81c2c92e47edaee6;
end
39:
begin
tmp_K = 64'h92722c851482353b;
end
40:
begin
tmp_K = 64'ha2bfe8a14cf10364;
end
41:
begin
tmp_K = 64'ha81a664bbc423001;
end
42:
begin
tmp_K = 64'hc24b8b70d0f89791;
end
43:
begin
tmp_K = 64'hc76c51a30654be30;
end
44:
begin
tmp_K = 64'hd192e819d6ef5218;
end
45:
begin
tmp_K = 64'hd69906245565a910;
end
46:
begin
tmp_K = 64'hf40e35855771202a;
end
47:
begin
tmp_K = 64'h106aa07032bbd1b8;
end
48:
begin
tmp_K = 64'h19a4c116b8d2d0c8;
end
49:
begin
tmp_K = 64'h1e376c085141ab53;
end
50:
begin
tmp_K = 64'h2748774cdf8eeb99;
end
51:
begin
tmp_K = 64'h34b0bcb5e19b48a8;
end
52:
begin
tmp_K = 64'h391c0cb3c5c95a63;
end
53:
begin
tmp_K = 64'h4ed8aa4ae3418acb;
end
54:
begin
tmp_K = 64'h5b9cca4f7763e373;
end
55:
begin
tmp_K = 64'h682e6ff3d6b2b8a3;
end
56:
begin
tmp_K = 64'h748f82ee5defb2fc;
end
57:
begin
tmp_K = 64'h78a5636f43172f60;
end
58:
begin
tmp_K = 64'h84c87814a1f0ab72;
end
59:
begin
tmp_K = 64'h8cc702081a6439ec;
end
60:
begin
tmp_K = 64'h90befffa23631e28;
end
61:
begin
tmp_K = 64'ha4506cebde82bde9;
end
62:
begin
tmp_K = 64'hbef9a3f7b2c67915;
end
63:
begin
tmp_K = 64'hc67178f2e372532b;
end
64:
begin
tmp_K = 64'hca273eceea26619c;
end
65:
begin
tmp_K = 64'hd186b8c721c0c207;
end
66:
begin
tmp_K = 64'heada7dd6cde0eb1e;
end
67:
begin
tmp_K = 64'hf57d4f7fee6ed178;
end
68:
begin
tmp_K = 64'h06f067aa72176fba;
end
69:
begin
tmp_K = 64'h0a637dc5a2c898a6;
end
70:
begin
tmp_K = 64'h113f9804bef90dae;
end
71:
begin
tmp_K = 64'h1b710b35131c471b;
end
72:
begin
tmp_K = 64'h28db77f523047d84;
end
73:
begin
tmp_K = 64'h32caab7b40c72493;
end
74:
begin
tmp_K = 64'h3c9ebe0a15c9bebc;
end
75:
begin
tmp_K = 64'h431d67c49c100d4c;
end
76:
begin
tmp_K = 64'h4cc5d4becb3e42b6;
end
77:
begin
tmp_K = 64'h597f299cfc657e2a;
end
78:
begin
tmp_K = 64'h5fcb6fab3ad6faec;
end
79:
begin
tmp_K = 64'h6c44198c4a475817;
end
default:
begin
tmp_K = 64'h0000000000000000;
end
endcase // case (addr)
end // block: addr_mux
endmodule // sha512_k_constants
//======================================================================
// sha512_k_constants.v
//======================================================================
|