Skip to content

Commit c6b4ab0

Browse files
committed
Optimize AsconCXof128 init for simple case
1 parent 78cb999 commit c6b4ab0

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

core/src/main/java/org/bouncycastle/crypto/digests/AsconCXof128.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,26 @@ public void reset()
8181

8282
private void initState(byte[] z, int zOff, int zLen)
8383
{
84-
p.set(7445901275803737603L, 4886737088792722364L, -1616759365661982283L, 3076320316797452470L, -8124743304765850554L);
85-
p.x0 ^= ((long)zLen) << 3;
86-
p.p(12);
87-
update(z, zOff, zLen);
88-
padAndAbsorb();
84+
// p.set(0x0000080000cc0004L, 0L, 0L, 0L, 0L);
85+
// p.p(12);
86+
87+
if (zLen == 0)
88+
{
89+
// p.p(12);
90+
// padAndAbsorb();
91+
92+
p.set(0x500cccc894e3c9e8L, 0x5bed06f28f71248dL, 0x3b03a0f930afd512L, 0x112ef093aa5c698bL, 0x00c8356340a347f0L);
93+
}
94+
else
95+
{
96+
p.set(0x675527c2a0e8de03L, 0x43d12d7dc0377bbcL, 0xe9901dec426e81b5L, 0x2ab14907720780b6L, 0x8f3f1d02d432bc46L);
97+
98+
p.x0 ^= ((long)zLen) << 3;
99+
p.p(12);
100+
update(z, zOff, zLen);
101+
padAndAbsorb();
102+
}
103+
89104
super.reset();
90105
}
91106
}
92-

0 commit comments

Comments
 (0)