authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2022-12-06 00:47:04+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-05 19:25:10-05:00
log397881fefb9acd204b14ee56d703410b4b1fae9e
treef85c5f6e33dd84fe13e606a41b94f4ee078e1ba7
parentdc852f8226749eb8dd5e1e2496f18a4d102f60b1

treshold -> threshold


1 files changed, 8 insertions(+), 8 deletions(-)

lib/std/crypto/ghash_polyval.zig+8-8
......@@ -32,9 +32,9 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
3232 pub const key_length = 16;
3333
3434 const pc_count = if (builtin.mode != .ReleaseSmall) 16 else 2;
35 const agg_4_treshold = 22;
36 const agg_8_treshold = 84;
37 const agg_16_treshold = 328;
35 const agg_4_threshold = 22;
36 const agg_8_threshold = 84;
37 const agg_16_threshold = 328;
3838
3939 // Before the Haswell architecture, the carryless multiplication instruction was
4040 // extremely slow. Even with 128-bit operands, using Karatsuba multiplication was
......@@ -65,13 +65,13 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
6565 if (builtin.mode != .ReleaseSmall) {
6666 hx[2] = reduce(clmul128(hx[1], h)); // h^3
6767 hx[3] = reduce(clsq128(hx[1])); // h^4 = h^2^2
68 if (block_count >= agg_8_treshold) {
68 if (block_count >= agg_8_threshold) {
6969 hx[4] = reduce(clmul128(hx[3], h)); // h^5
7070 hx[5] = reduce(clsq128(hx[2])); // h^6 = h^3^2
7171 hx[6] = reduce(clmul128(hx[5], h)); // h^7
7272 hx[7] = reduce(clsq128(hx[3])); // h^8 = h^4^2
7373 }
74 if (block_count >= agg_16_treshold) {
74 if (block_count >= agg_16_threshold) {
7575 var i: usize = 8;
7676 while (i < 16) : (i += 2) {
7777 hx[i] = reduce(clmul128(hx[i - 1], h));
......@@ -263,7 +263,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
263263
264264 var i: usize = 0;
265265
266 if (builtin.mode != .ReleaseSmall and msg.len >= agg_16_treshold * block_length) {
266 if (builtin.mode != .ReleaseSmall and msg.len >= agg_16_threshold * block_length) {
267267 // 16-blocks aggregated reduction
268268 while (i + 256 <= msg.len) : (i += 256) {
269269 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[15 - 0]);
......@@ -273,7 +273,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
273273 }
274274 acc = reduce(u);
275275 }
276 } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_8_treshold * block_length) {
276 } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_8_threshold * block_length) {
277277 // 8-blocks aggregated reduction
278278 while (i + 128 <= msg.len) : (i += 128) {
279279 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[7 - 0]);
......@@ -283,7 +283,7 @@ fn Hash(comptime endian: std.builtin.Endian, comptime shift_key: bool) type {
283283 }
284284 acc = reduce(u);
285285 }
286 } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_4_treshold * block_length) {
286 } else if (builtin.mode != .ReleaseSmall and msg.len >= agg_4_threshold * block_length) {
287287 // 4-blocks aggregated reduction
288288 while (i + 64 <= msg.len) : (i += 64) {
289289 var u = clmul128(acc ^ mem.readInt(u128, msg[i..][0..16], endian), st.hx[3 - 0]);