1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package io.github.tonywasher.joceanus.gordianknot.api.digest.spec;
19
20 import io.github.tonywasher.joceanus.gordianknot.api.base.GordianLength;
21 import io.github.tonywasher.joceanus.gordianknot.api.digest.spec.GordianDigestSubSpec.GordianDigestState;
22
23
24
25
26 public interface GordianDigestSpecBuilder {
27
28
29
30
31
32
33 GordianDigestSpecBuilder withType(GordianDigestType pType);
34
35
36
37
38
39
40
41 GordianDigestSpecBuilder withState(GordianDigestState pState);
42
43
44
45
46
47
48
49 GordianDigestSpecBuilder withLength(GordianLength pLength);
50
51
52
53
54
55
56 GordianDigestSpecBuilder asXof();
57
58
59
60
61
62
63 GordianDigestSpec build();
64
65
66
67
68
69
70
71
72 default GordianDigestSpec digest(final GordianDigestType pType) {
73 return withType(pType).build();
74 }
75
76
77
78
79
80
81
82
83 default GordianDigestSpec digest(final GordianDigestType pType,
84 final GordianLength pLength) {
85 return withType(pType).withLength(pLength).build();
86 }
87
88
89
90
91
92
93
94
95
96
97 default GordianDigestSpec digest(final GordianDigestType pType,
98 final GordianDigestState pState,
99 final GordianLength pLength,
100 final boolean pXofMode) {
101 withType(pType).withState(pState).withLength(pLength);
102 if (pXofMode) {
103 asXof();
104 }
105 return build();
106 }
107
108
109
110
111
112
113 default GordianDigestSpec md2() {
114 return withType(GordianDigestType.MD2).build();
115 }
116
117
118
119
120
121
122 default GordianDigestSpec md4() {
123 return withType(GordianDigestType.MD4).build();
124 }
125
126
127
128
129
130
131 default GordianDigestSpec md5() {
132 return withType(GordianDigestType.MD5).build();
133 }
134
135
136
137
138
139
140 default GordianDigestSpec sha1() {
141 return withType(GordianDigestType.SHA1).build();
142 }
143
144
145
146
147
148
149 default GordianDigestSpec sm3() {
150 return withType(GordianDigestType.SM3).build();
151 }
152
153
154
155
156
157
158 default GordianDigestSpec whirlpool() {
159 return withType(GordianDigestType.WHIRLPOOL).build();
160 }
161
162
163
164
165
166
167 default GordianDigestSpec tiger() {
168 return withType(GordianDigestType.TIGER).build();
169 }
170
171
172
173
174
175
176
177 default GordianDigestSpec sha2(final GordianLength pLength) {
178 return withType(GordianDigestType.SHA2).withLength(pLength).build();
179 }
180
181
182
183
184
185
186
187
188 default GordianDigestSpec sha2(final GordianDigestState pState,
189 final GordianLength pLength) {
190 return withType(GordianDigestType.SHA2).withState(pState).withLength(pLength).build();
191 }
192
193
194
195
196
197
198
199 default GordianDigestSpec sha3(final GordianLength pLength) {
200 return withType(GordianDigestType.SHA3).withLength(pLength).build();
201 }
202
203
204
205
206
207
208
209 default GordianDigestSpec blake2s(final GordianLength pLength) {
210 return withType(GordianDigestType.BLAKE2).withState(GordianDigestState.STATE256).withLength(pLength).build();
211 }
212
213
214
215
216
217
218
219 default GordianDigestSpec blake2b(final GordianLength pLength) {
220 return withType(GordianDigestType.BLAKE2).withState(GordianDigestState.STATE512).withLength(pLength).build();
221 }
222
223
224
225
226
227
228
229
230 default GordianDigestSpec blake2(final GordianDigestState pState,
231 final GordianLength pLength) {
232 return withType(GordianDigestType.BLAKE2).withState(pState).withLength(pLength).build();
233 }
234
235
236
237
238
239
240 default GordianDigestSpec blake2Xs() {
241 return blake2X(GordianDigestState.STATE256);
242 }
243
244
245
246
247
248
249 default GordianDigestSpec blake2Xb() {
250 return blake2X(GordianDigestState.STATE512);
251 }
252
253
254
255
256
257
258
259 default GordianDigestSpec blake2X(final GordianDigestState pState) {
260 return withType(GordianDigestType.BLAKE2).withState(pState).asXof().build();
261 }
262
263
264
265
266
267
268
269 default GordianDigestSpec blake3(final GordianLength pLength) {
270 return withType(GordianDigestType.BLAKE3).withLength(pLength).build();
271 }
272
273
274
275
276
277
278 default GordianDigestSpec gost() {
279 return withType(GordianDigestType.GOST).build();
280 }
281
282
283
284
285
286
287
288 default GordianDigestSpec streebog(final GordianLength pLength) {
289 return withType(GordianDigestType.STREEBOG).withLength(pLength).build();
290 }
291
292
293
294
295
296
297
298 default GordianDigestSpec skein(final GordianLength pLength) {
299 return withType(GordianDigestType.SKEIN).withLength(pLength).build();
300 }
301
302
303
304
305
306
307
308
309 default GordianDigestSpec skein(final GordianDigestState pState,
310 final GordianLength pLength) {
311 return withType(GordianDigestType.SKEIN).withState(pState).withLength(pLength).build();
312 }
313
314
315
316
317
318
319
320 default GordianDigestSpec skeinX(final GordianDigestState pState) {
321 return withType(GordianDigestType.SKEIN).withState(pState).asXof().build();
322 }
323
324
325
326
327
328
329
330 default GordianDigestSpec ripemd(final GordianLength pLength) {
331 return withType(GordianDigestType.RIPEMD).withLength(pLength).build();
332 }
333
334
335
336
337
338
339 default GordianDigestSpec shake128() {
340 return withType(GordianDigestType.SHAKE).withState(GordianDigestState.STATE128).withLength(GordianLength.LEN_256).build();
341 }
342
343
344
345
346
347
348 default GordianDigestSpec shake256() {
349 return withType(GordianDigestType.SHAKE).withState(GordianDigestState.STATE256).withLength(GordianLength.LEN_512).build();
350 }
351
352
353
354
355
356
357
358 default GordianDigestSpec kupyna(final GordianLength pLength) {
359 return withType(GordianDigestType.KUPYNA).withLength(pLength).build();
360 }
361
362
363
364
365
366
367
368 default GordianDigestSpec jh(final GordianLength pLength) {
369 return withType(GordianDigestType.JH).withLength(pLength).build();
370 }
371
372
373
374
375
376
377
378 default GordianDigestSpec groestl(final GordianLength pLength) {
379 return withType(GordianDigestType.GROESTL).withLength(pLength).build();
380 }
381
382
383
384
385
386
387
388 default GordianDigestSpec cubeHash(final GordianLength pLength) {
389 return withType(GordianDigestType.CUBEHASH).withLength(pLength).build();
390 }
391
392
393
394
395
396
397
398 default GordianDigestSpec kangaroo(final GordianLength pLength) {
399 return withType(GordianDigestType.KANGAROO).withState(GordianDigestState.STATE128).withLength(pLength).build();
400 }
401
402
403
404
405
406
407
408 default GordianDigestSpec marsupimal(final GordianLength pLength) {
409 return withType(GordianDigestType.KANGAROO).withState(GordianDigestState.STATE256).withLength(pLength).build();
410 }
411
412
413
414
415
416
417 default GordianDigestSpec haraka256() {
418 return withType(GordianDigestType.HARAKA).withState(GordianDigestState.STATE256).withLength(GordianLength.LEN_256).build();
419 }
420
421
422
423
424
425
426 default GordianDigestSpec haraka512() {
427 return withType(GordianDigestType.HARAKA).withState(GordianDigestState.STATE512).withLength(GordianLength.LEN_256).build();
428 }
429
430
431
432
433
434
435 default GordianDigestSpec ascon() {
436 return withType(GordianDigestType.ASCON).build();
437 }
438
439
440
441
442
443
444 default GordianDigestSpec asconX() {
445 return withType(GordianDigestType.ASCON).asXof().build();
446 }
447
448
449
450
451
452
453 default GordianDigestSpec isap() {
454 return withType(GordianDigestType.ISAP).build();
455 }
456
457
458
459
460
461
462 default GordianDigestSpec photonBeetle() {
463 return withType(GordianDigestType.PHOTONBEETLE).build();
464 }
465
466
467
468
469
470
471 default GordianDigestSpec romulus() {
472 return withType(GordianDigestType.ROMULUS).build();
473 }
474
475
476
477
478
479
480
481 default GordianDigestSpec sparkle(final GordianLength pLength) {
482 return withType(GordianDigestType.SPARKLE).withLength(pLength).build();
483 }
484
485
486
487
488
489
490 default GordianDigestSpec xoodyak() {
491 return withType(GordianDigestType.XOODYAK).build();
492 }
493 }