Skip to content

Commit f8fd856

Browse files
committed
Attempt to grab width by range
Should help with derivates
1 parent 1bc3c3f commit f8fd856

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

source/sha3d.d

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ public struct KECCAK(uint digestSize,
6262
}
6363

6464
static assert(width % 25 == 0, "Width must be a power of 25.");
65-
static assert(width <= 1600, "Width can't be over 1600 bits.");
66-
static assert(width >= 200, "Widths under 200 bits is currently not supported.");
67-
static assert(rounds <= 24, "Can't have more than 24 rounds.");
68-
static assert(rounds > 0, "Must have one or more rounds.");
65+
static assert(width <= 1600, "Width can't be over 1600 bits.");
66+
static assert(width >= 200, "Widths under 200 bits is currently not supported.");
67+
static assert(rounds <= 24, "Can't have more than 24 rounds.");
68+
static assert(rounds > 0, "Must have one or more rounds.");
6969

7070
// NOTE: Type selection
7171
//
@@ -90,7 +90,7 @@ public struct KECCAK(uint digestSize,
9090
// 22 for b=800, 20 for b=400, 18 for b=200, 16 for b=100, 14 for b=50,
9191
// and 12 for b=25.
9292

93-
static if (width == 1600)
93+
static if (width >= 1600)
9494
{
9595
/// RC values for Keccak-p[1600]
9696
private enum K_RC_IMPL = [ // @suppress(dscanner.performance.enum_array_literal)
@@ -107,7 +107,7 @@ public struct KECCAK(uint digestSize,
107107
];
108108
alias ktype = ulong;
109109
}
110-
else static if (width == 800)
110+
else static if (width >= 800)
111111
{
112112
/// RC values for Keccak-p[800]
113113
private enum K_RC_IMPL = [ // @suppress(dscanner.performance.enum_array_literal)
@@ -124,7 +124,7 @@ public struct KECCAK(uint digestSize,
124124
];
125125
alias ktype = uint;
126126
}
127-
else static if (width == 400)
127+
else static if (width >= 400)
128128
{
129129
/// RC values for Keccak-p[400]
130130
private enum K_RC = [ // @suppress(dscanner.performance.enum_array_literal)
@@ -141,7 +141,7 @@ public struct KECCAK(uint digestSize,
141141
];
142142
alias ktype = ushort;
143143
}
144-
else static if (width == 200)
144+
else static if (width >= 200)
145145
{
146146
/// RC values for Keccak-p[200]
147147
private enum K_RC = [ // @suppress(dscanner.performance.enum_array_literal)
@@ -967,7 +967,7 @@ version (TestOverflow)
967967
K12 k12;
968968
k12.enable_verbose();
969969
assert(k12.finish() == hexString!(
970-
//assert(k12Of("") == hexString!(
970+
assert(k12Of("") == hexString!(
971971
"1ac2d450fc3b4205d19da7bfca1b37513c0803577ac7167f06fe2ce1f0ef39e542"));
972972
}+/
973973

0 commit comments

Comments
 (0)