@zigc/lib 0.17.0-dev.224 → 0.17.0-dev.242
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/c/math.zig +31 -2
- package/compiler/build_runner.zig +1 -1
- package/compiler/reduce/Walk.zig +1 -6
- package/compiler/resinator/compile.zig +1 -1
- package/compiler/resinator/cvtres.zig +4 -4
- package/compiler/resinator/ico.zig +4 -4
- package/compiler/resinator/parse.zig +2 -2
- package/compiler/resinator/res.zig +1 -1
- package/compiler/translate-c/ast.zig +11 -21
- package/compiler_rt/atomics.zig +1 -1
- package/compiler_rt/cos.zig +1 -1
- package/compiler_rt/rem_pio2l.zig +1 -1
- package/compiler_rt/sin.zig +1 -1
- package/compiler_rt/sincos.zig +1 -1
- package/compiler_rt/ssp.zig +2 -2
- package/compiler_rt/tan.zig +1 -1
- package/docs/wasm/Walk.zig +1 -3
- package/docs/wasm/html_render.zig +1 -2
- package/package.json +1 -1
- package/std/Build/Step/ConfigHeader.zig +1 -1
- package/std/Io/Kqueue.zig +1 -1
- package/std/Io/Reader.zig +0 -5
- package/std/Io/Threaded.zig +4 -4
- package/std/Io/Writer.zig +1 -2
- package/std/Io/net/HostName.zig +11 -6
- package/std/Random/ChaCha.zig +2 -2
- package/std/Random/benchmark.zig +2 -2
- package/std/Thread.zig +2 -2
- package/std/base64.zig +5 -5
- package/std/bit_set.zig +83 -66
- package/std/c.zig +19 -19
- package/std/compress/flate/Decompress.zig +1 -1
- package/std/crypto/25519/curve25519.zig +2 -2
- package/std/crypto/25519/edwards25519.zig +3 -3
- package/std/crypto/25519/ristretto255.zig +2 -2
- package/std/crypto/25519/scalar.zig +6 -6
- package/std/crypto/25519/x25519.zig +1 -1
- package/std/crypto/Certificate.zig +1 -1
- package/std/crypto/Sha1.zig +1 -1
- package/std/crypto/aegis.zig +45 -39
- package/std/crypto/aes_ccm.zig +20 -20
- package/std/crypto/aes_gcm.zig +10 -12
- package/std/crypto/aes_ocb.zig +9 -9
- package/std/crypto/argon2.zig +15 -15
- package/std/crypto/bcrypt.zig +20 -10
- package/std/crypto/benchmark.zig +7 -7
- package/std/crypto/blake2.zig +100 -64
- package/std/crypto/cbc_mac.zig +1 -1
- package/std/crypto/chacha20.zig +10 -10
- package/std/crypto/cmac.zig +2 -2
- package/std/crypto/codecs/asn1.zig +1 -1
- package/std/crypto/codecs/base64_hex_ct.zig +1 -1
- package/std/crypto/ecdsa.zig +9 -9
- package/std/crypto/ff.zig +2 -2
- package/std/crypto/ghash_polyval.zig +4 -4
- package/std/crypto/hkdf.zig +1 -1
- package/std/crypto/isap.zig +3 -3
- package/std/crypto/kangarootwelve.zig +1 -1
- package/std/crypto/keccak_p.zig +7 -7
- package/std/crypto/md5.zig +1 -1
- package/std/crypto/ml_dsa.zig +33 -33
- package/std/crypto/ml_kem.zig +4 -4
- package/std/crypto/modes.zig +1 -1
- package/std/crypto/pbkdf2.zig +1 -1
- package/std/crypto/pcurves/p256/scalar.zig +3 -3
- package/std/crypto/pcurves/p384/scalar.zig +2 -2
- package/std/crypto/pcurves/secp256k1/scalar.zig +3 -3
- package/std/crypto/pcurves/tests/p256.zig +5 -5
- package/std/crypto/pcurves/tests/p384.zig +5 -5
- package/std/crypto/pcurves/tests/secp256k1.zig +3 -3
- package/std/crypto/salsa20.zig +8 -8
- package/std/crypto/sha2.zig +2 -2
- package/std/crypto/sha3.zig +2 -2
- package/std/crypto/siphash.zig +1 -1
- package/std/crypto/timing_safe.zig +5 -4
- package/std/crypto/tls/Client.zig +10 -9
- package/std/crypto.zig +3 -3
- package/std/debug/Dwarf.zig +1 -1
- package/std/debug.zig +6 -4
- package/std/elf.zig +1 -1
- package/std/enums.zig +3 -3
- package/std/fmt/parse_float/decimal.zig +1 -1
- package/std/fmt.zig +5 -1
- package/std/fs/path.zig +1 -1
- package/std/hash/Adler32.zig +3 -3
- package/std/hash/benchmark.zig +2 -2
- package/std/hash/wyhash.zig +1 -1
- package/std/heap/debug_allocator.zig +1 -1
- package/std/http.zig +1 -1
- package/std/json/static.zig +2 -2
- package/std/math/big/int.zig +3 -3
- package/std/math/float.zig +62 -0
- package/std/math/nextafter.zig +1 -2
- package/std/math/powi.zig +2 -3
- package/std/math/signbit.zig +0 -1
- package/std/math.zig +13 -18
- package/std/mem.zig +9 -8
- package/std/meta.zig +1 -1
- package/std/os/emscripten.zig +2 -2
- package/std/os/linux.zig +4 -4
- package/std/os/uefi/hii.zig +1 -1
- package/std/std.zig +3 -0
- package/std/tar/Writer.zig +39 -33
- package/std/tar.zig +8 -4
- package/std/testing.zig +1 -1
- package/std/unicode.zig +13 -8
- package/std/zig/Ast/Render.zig +1 -25
- package/std/zig/Ast.zig +5 -28
- package/std/zig/AstGen.zig +75 -184
- package/std/zig/AstRlAnnotate.zig +1 -11
- package/std/zig/AstSmith.zig +5 -11
- package/std/zig/LibCInstallation.zig +1 -1
- package/std/zig/Parse.zig +4 -69
- package/std/zig/TokenSmith.zig +0 -6
- package/std/zig/WindowsSdk.zig +1 -1
- package/std/zig/Zir.zig +0 -54
- package/std/zig/ZonGen.zig +0 -1
- package/std/zig/llvm/Builder.zig +3 -7
- package/std/zig/tokenizer.zig +4 -43
- package/std/zig.zig +0 -2
- package/compiler_rt/long_double.zig +0 -37
- package/libc/mingw/math/lrintl.c +0 -18
- package/libc/mingw/math/rintl.c +0 -16
- package/libc/musl/src/math/i386/lrintl.c +0 -8
- package/libc/musl/src/math/i386/rintl.c +0 -7
- package/libc/musl/src/math/lrintl.c +0 -36
- package/libc/musl/src/math/rintl.c +0 -29
- package/libc/musl/src/math/s390x/rintl.c +0 -15
- package/libc/musl/src/math/x32/lrintl.s +0 -7
- package/libc/musl/src/math/x32/rintl.s +0 -6
- package/libc/musl/src/math/x86_64/lrintl.c +0 -8
- package/libc/musl/src/math/x86_64/rintl.c +0 -7
package/std/crypto/keccak_p.zig
CHANGED
|
@@ -40,7 +40,7 @@ pub fn KeccakF(comptime f: u11) type {
|
|
|
40
40
|
break :rc rc;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
st: Block =
|
|
43
|
+
st: Block = @splat(0),
|
|
44
44
|
|
|
45
45
|
/// Initialize the state from a slice of bytes.
|
|
46
46
|
pub fn init(bytes: [block_bytes]u8) Self {
|
|
@@ -70,7 +70,7 @@ pub fn KeccakF(comptime f: u11) type {
|
|
|
70
70
|
self.st[i / @sizeOf(T)] = mem.readInt(T, bytes[i..][0..@sizeOf(T)], .little);
|
|
71
71
|
}
|
|
72
72
|
if (i < bytes.len) {
|
|
73
|
-
var padded
|
|
73
|
+
var padded: [@sizeOf(T)]u8 = @splat(0);
|
|
74
74
|
@memcpy(padded[0 .. bytes.len - i], bytes[i..]);
|
|
75
75
|
self.st[i / @sizeOf(T)] = mem.readInt(T, padded[0..], .little);
|
|
76
76
|
}
|
|
@@ -89,7 +89,7 @@ pub fn KeccakF(comptime f: u11) type {
|
|
|
89
89
|
self.st[i / @sizeOf(T)] ^= mem.readInt(T, bytes[i..][0..@sizeOf(T)], .little);
|
|
90
90
|
}
|
|
91
91
|
if (i < bytes.len) {
|
|
92
|
-
var padded
|
|
92
|
+
var padded: [@sizeOf(T)]u8 = @splat(0);
|
|
93
93
|
@memcpy(padded[0 .. bytes.len - i], bytes[i..]);
|
|
94
94
|
self.st[i / @sizeOf(T)] ^= mem.readInt(T, padded[0..], .little);
|
|
95
95
|
}
|
|
@@ -102,7 +102,7 @@ pub fn KeccakF(comptime f: u11) type {
|
|
|
102
102
|
mem.writeInt(T, out[i..][0..@sizeOf(T)], self.st[i / @sizeOf(T)], .little);
|
|
103
103
|
}
|
|
104
104
|
if (i < out.len) {
|
|
105
|
-
var padded
|
|
105
|
+
var padded: [@sizeOf(T)]u8 = @splat(0);
|
|
106
106
|
mem.writeInt(T, padded[0..], self.st[i / @sizeOf(T)], .little);
|
|
107
107
|
@memcpy(out[i..], padded[0 .. out.len - i]);
|
|
108
108
|
}
|
|
@@ -118,7 +118,7 @@ pub fn KeccakF(comptime f: u11) type {
|
|
|
118
118
|
mem.writeInt(T, out[i..][0..@sizeOf(T)], x, native_endian);
|
|
119
119
|
}
|
|
120
120
|
if (i < in.len) {
|
|
121
|
-
var padded
|
|
121
|
+
var padded: [@sizeOf(T)]u8 = @splat(0);
|
|
122
122
|
@memcpy(padded[0 .. in.len - i], in[i..]);
|
|
123
123
|
const x = mem.readInt(T, &padded, native_endian) ^ mem.nativeToLittle(T, self.st[i / @sizeOf(T)]);
|
|
124
124
|
mem.writeInt(T, &padded, x, native_endian);
|
|
@@ -140,7 +140,7 @@ pub fn KeccakF(comptime f: u11) type {
|
|
|
140
140
|
const st = &self.st;
|
|
141
141
|
|
|
142
142
|
// theta
|
|
143
|
-
var t
|
|
143
|
+
var t: [5]T = @splat(0);
|
|
144
144
|
inline for (0..5) |i| {
|
|
145
145
|
inline for (0..5) |j| {
|
|
146
146
|
t[i] ^= st[j * 5 + i];
|
|
@@ -382,7 +382,7 @@ test "Keccak-f800" {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
test "squeeze" {
|
|
385
|
-
var st
|
|
385
|
+
var st: State(800, 256, 22) = .init(@splat(0x80), 0x01);
|
|
386
386
|
|
|
387
387
|
var out0: [15]u8 = undefined;
|
|
388
388
|
var out1: [out0.len]u8 = undefined;
|
package/std/crypto/md5.zig
CHANGED
package/std/crypto/ml_dsa.zig
CHANGED
|
@@ -156,7 +156,7 @@ const Params = struct {
|
|
|
156
156
|
const Poly = struct {
|
|
157
157
|
cs: [N]u32,
|
|
158
158
|
|
|
159
|
-
const zero: Poly = .{ .cs =
|
|
159
|
+
const zero: Poly = .{ .cs = @splat(0) };
|
|
160
160
|
|
|
161
161
|
// Add two polynomials (no normalization)
|
|
162
162
|
fn add(a: Poly, b: Poly) Poly {
|
|
@@ -302,7 +302,7 @@ fn PolyVec(comptime len: u8) type {
|
|
|
302
302
|
ps: [len]Poly,
|
|
303
303
|
|
|
304
304
|
const Self = @This();
|
|
305
|
-
const zero: Self = .{ .ps = .
|
|
305
|
+
const zero: Self = .{ .ps = @splat(.zero) };
|
|
306
306
|
|
|
307
307
|
/// Apply a unary operation to each polynomial in the vector
|
|
308
308
|
fn map(v: Self, comptime op: fn (Poly) Poly) Self {
|
|
@@ -581,7 +581,7 @@ fn PolyVec(comptime len: u8) type {
|
|
|
581
581
|
|
|
582
582
|
/// Unpack hints from bytes
|
|
583
583
|
fn unpackHint(comptime omega: u16, buf: []const u8) ?Self {
|
|
584
|
-
var result: Self = .{ .ps = .
|
|
584
|
+
var result: Self = .{ .ps = @splat(.zero) };
|
|
585
585
|
var prev_sop: u8 = 0; // previous switch-over-point
|
|
586
586
|
|
|
587
587
|
for (0..len) |i| {
|
|
@@ -1839,7 +1839,7 @@ fn MLDSAImpl(comptime p: Params) type {
|
|
|
1839
1839
|
return Signer{
|
|
1840
1840
|
.h = h,
|
|
1841
1841
|
.secret_key = secret_key,
|
|
1842
|
-
.rnd = noise orelse
|
|
1842
|
+
.rnd = noise orelse @splat(0),
|
|
1843
1843
|
};
|
|
1844
1844
|
}
|
|
1845
1845
|
|
|
@@ -2324,7 +2324,7 @@ test "decompose correctness for ML-DSA-87" {
|
|
|
2324
2324
|
|
|
2325
2325
|
test "polyDeriveUniform deterministic" {
|
|
2326
2326
|
// Test that polyDeriveUniform produces deterministic results
|
|
2327
|
-
const seed: [32]u8 = .{0x01} ++
|
|
2327
|
+
const seed: [32]u8 = .{0x01} ++ @as([31]u8, @splat(0x00));
|
|
2328
2328
|
const nonce: u16 = 0;
|
|
2329
2329
|
|
|
2330
2330
|
const p1 = polyDeriveUniform(&seed, nonce);
|
|
@@ -2343,7 +2343,7 @@ test "polyDeriveUniform deterministic" {
|
|
|
2343
2343
|
|
|
2344
2344
|
test "polyDeriveUniform different nonces" {
|
|
2345
2345
|
// Test that different nonces produce different polynomials
|
|
2346
|
-
const seed: [32]u8 = .{0x01} ++
|
|
2346
|
+
const seed: [32]u8 = .{0x01} ++ @as([31]u8, @splat(0x00));
|
|
2347
2347
|
|
|
2348
2348
|
const p1 = polyDeriveUniform(&seed, 0);
|
|
2349
2349
|
const p2 = polyDeriveUniform(&seed, 1);
|
|
@@ -2361,7 +2361,7 @@ test "polyDeriveUniform different nonces" {
|
|
|
2361
2361
|
|
|
2362
2362
|
test "expandS with eta=2" {
|
|
2363
2363
|
// Test eta=2 sampling
|
|
2364
|
-
const seed: [64]u8 = .{0x02} ++
|
|
2364
|
+
const seed: [64]u8 = .{0x02} ++ @as([63]u8, @splat(0x00));
|
|
2365
2365
|
const nonce: u16 = 0;
|
|
2366
2366
|
|
|
2367
2367
|
const p = expandS(2, &seed, nonce);
|
|
@@ -2378,7 +2378,7 @@ test "expandS with eta=2" {
|
|
|
2378
2378
|
|
|
2379
2379
|
test "expandS with eta=4" {
|
|
2380
2380
|
// Test eta=4 sampling
|
|
2381
|
-
const seed: [64]u8 = .{0x03} ++
|
|
2381
|
+
const seed: [64]u8 = .{0x03} ++ @as([63]u8, @splat(0x00));
|
|
2382
2382
|
const nonce: u16 = 0;
|
|
2383
2383
|
|
|
2384
2384
|
const p = expandS(4, &seed, nonce);
|
|
@@ -2395,7 +2395,7 @@ test "expandS with eta=4" {
|
|
|
2395
2395
|
test "sampleInBall has correct weight" {
|
|
2396
2396
|
// Test that ball polynomial has exactly tau non-zero coefficients
|
|
2397
2397
|
const tau = 39; // From ML-DSA-44
|
|
2398
|
-
const seed: [32]u8 = .{
|
|
2398
|
+
const seed: [32]u8 = .{0x03} ++ @as([31]u8, @splat(0x00));
|
|
2399
2399
|
|
|
2400
2400
|
const p = sampleInBall(tau, &seed);
|
|
2401
2401
|
|
|
@@ -2415,7 +2415,7 @@ test "sampleInBall has correct weight" {
|
|
|
2415
2415
|
test "sampleInBall deterministic" {
|
|
2416
2416
|
// Test that ball sampling is deterministic
|
|
2417
2417
|
const tau = 49; // From ML-DSA-65
|
|
2418
|
-
const seed: [32]u8 = .{0x05} ++
|
|
2418
|
+
const seed: [32]u8 = .{0x05} ++ @as([31]u8, @splat(0x00));
|
|
2419
2419
|
|
|
2420
2420
|
const p1 = sampleInBall(tau, &seed);
|
|
2421
2421
|
const p2 = sampleInBall(tau, &seed);
|
|
@@ -2851,13 +2851,13 @@ test "Key generation basic - all variants" {
|
|
|
2851
2851
|
.{ .variant = MLDSA65, .seed_byte = 0x65 },
|
|
2852
2852
|
.{ .variant = MLDSA87, .seed_byte = 0x87 },
|
|
2853
2853
|
}) |config| {
|
|
2854
|
-
const seed
|
|
2854
|
+
const seed: [32]u8 = @splat(config.seed_byte);
|
|
2855
2855
|
try testKeyGenerationBasic(config.variant, seed);
|
|
2856
2856
|
}
|
|
2857
2857
|
}
|
|
2858
2858
|
|
|
2859
2859
|
test "Key generation determinism" {
|
|
2860
|
-
const seed = [_]u8{ 0x12, 0x34, 0x56, 0x78 } ++ [
|
|
2860
|
+
const seed = [_]u8{ 0x12, 0x34, 0x56, 0x78 } ++ @as([28]u8, @splat(0xAB));
|
|
2861
2861
|
|
|
2862
2862
|
// Generate two key pairs from the same seed
|
|
2863
2863
|
const result1 = MLDSA44.newKeyFromSeed(&seed);
|
|
@@ -2874,7 +2874,7 @@ test "Key generation determinism" {
|
|
|
2874
2874
|
}
|
|
2875
2875
|
|
|
2876
2876
|
test "Private key can compute public key" {
|
|
2877
|
-
const seed
|
|
2877
|
+
const seed: [32]u8 = @splat(0xFF);
|
|
2878
2878
|
const result = MLDSA44.newKeyFromSeed(&seed);
|
|
2879
2879
|
const pk = result.pk;
|
|
2880
2880
|
const sk = result.sk;
|
|
@@ -2907,13 +2907,13 @@ test "Sign and verify - all variants" {
|
|
|
2907
2907
|
.{ .variant = MLDSA65, .seed_byte = 0x65, .message = "Hello, ML-DSA-65!" },
|
|
2908
2908
|
.{ .variant = MLDSA87, .seed_byte = 0x87, .message = "Hello, ML-DSA-87!" },
|
|
2909
2909
|
}) |config| {
|
|
2910
|
-
const seed
|
|
2910
|
+
const seed: [32]u8 = @splat(config.seed_byte);
|
|
2911
2911
|
try testSignAndVerify(config.variant, seed, config.message);
|
|
2912
2912
|
}
|
|
2913
2913
|
}
|
|
2914
2914
|
|
|
2915
2915
|
test "Invalid signature rejection" {
|
|
2916
|
-
const seed
|
|
2916
|
+
const seed: [32]u8 = @splat(0x99);
|
|
2917
2917
|
const result = MLDSA44.newKeyFromSeed(&seed);
|
|
2918
2918
|
const kp = try MLDSA44.KeyPair.fromSecretKey(result.sk);
|
|
2919
2919
|
|
|
@@ -2934,7 +2934,7 @@ test "Invalid signature rejection" {
|
|
|
2934
2934
|
}
|
|
2935
2935
|
|
|
2936
2936
|
test "Context string support" {
|
|
2937
|
-
const seed
|
|
2937
|
+
const seed: [32]u8 = @splat(0xAA);
|
|
2938
2938
|
const result = MLDSA44.newKeyFromSeed(&seed);
|
|
2939
2939
|
const kp = try MLDSA44.KeyPair.fromSecretKey(result.sk);
|
|
2940
2940
|
|
|
@@ -2964,17 +2964,17 @@ test "Context string support" {
|
|
|
2964
2964
|
try testing.expectError(error.SignatureVerificationFailed, sig2.verifyWithContext(message, kp.public_key, context1));
|
|
2965
2965
|
|
|
2966
2966
|
// Test maximum context length (255 bytes)
|
|
2967
|
-
const max_context
|
|
2967
|
+
const max_context: [255]u8 = @splat(0xBB);
|
|
2968
2968
|
const sig3 = try kp.signWithContext(message, null, &max_context);
|
|
2969
2969
|
try sig3.verifyWithContext(message, kp.public_key, &max_context);
|
|
2970
2970
|
|
|
2971
2971
|
// Test context too long (256 bytes should fail)
|
|
2972
|
-
const too_long_context
|
|
2972
|
+
const too_long_context: [256]u8 = @splat(0xCC);
|
|
2973
2973
|
try testing.expectError(error.ContextTooLong, kp.signWithContext(message, null, &too_long_context));
|
|
2974
2974
|
}
|
|
2975
2975
|
|
|
2976
2976
|
test "Context string with streaming API" {
|
|
2977
|
-
const seed
|
|
2977
|
+
const seed: [32]u8 = @splat(0xDD);
|
|
2978
2978
|
const result = MLDSA44.newKeyFromSeed(&seed);
|
|
2979
2979
|
const kp = try MLDSA44.KeyPair.fromSecretKey(result.sk);
|
|
2980
2980
|
|
|
@@ -3002,12 +3002,12 @@ test "Context string with streaming API" {
|
|
|
3002
3002
|
}
|
|
3003
3003
|
|
|
3004
3004
|
test "Signature determinism (same rnd)" {
|
|
3005
|
-
const seed
|
|
3005
|
+
const seed: [32]u8 = @splat(0x11);
|
|
3006
3006
|
const result = MLDSA44.newKeyFromSeed(&seed);
|
|
3007
3007
|
const sk = result.sk;
|
|
3008
3008
|
|
|
3009
3009
|
const message = "Deterministic test";
|
|
3010
|
-
const rnd
|
|
3010
|
+
const rnd: [32]u8 = @splat(0x22);
|
|
3011
3011
|
|
|
3012
3012
|
// Sign twice with same randomness using streaming API
|
|
3013
3013
|
var st1 = try sk.signer(rnd);
|
|
@@ -3023,7 +3023,7 @@ test "Signature determinism (same rnd)" {
|
|
|
3023
3023
|
}
|
|
3024
3024
|
|
|
3025
3025
|
test "Signature toBytes/fromBytes roundtrip" {
|
|
3026
|
-
const seed
|
|
3026
|
+
const seed: [32]u8 = @splat(0x33);
|
|
3027
3027
|
const result = MLDSA44.newKeyFromSeed(&seed);
|
|
3028
3028
|
const kp = try MLDSA44.KeyPair.fromSecretKey(result.sk);
|
|
3029
3029
|
|
|
@@ -3043,7 +3043,7 @@ test "Signature toBytes/fromBytes roundtrip" {
|
|
|
3043
3043
|
}
|
|
3044
3044
|
|
|
3045
3045
|
test "Empty message signing" {
|
|
3046
|
-
const seed
|
|
3046
|
+
const seed: [32]u8 = @splat(0x44);
|
|
3047
3047
|
const result = MLDSA44.newKeyFromSeed(&seed);
|
|
3048
3048
|
const kp = try MLDSA44.KeyPair.fromSecretKey(result.sk);
|
|
3049
3049
|
|
|
@@ -3057,12 +3057,12 @@ test "Empty message signing" {
|
|
|
3057
3057
|
}
|
|
3058
3058
|
|
|
3059
3059
|
test "Long message signing" {
|
|
3060
|
-
const seed
|
|
3060
|
+
const seed: [32]u8 = @splat(0x55);
|
|
3061
3061
|
const result = MLDSA44.newKeyFromSeed(&seed);
|
|
3062
3062
|
const kp = try MLDSA44.KeyPair.fromSecretKey(result.sk);
|
|
3063
3063
|
|
|
3064
3064
|
// Create a long message (1KB)
|
|
3065
|
-
const long_message
|
|
3065
|
+
const long_message: [1024]u8 = @splat(0xAB);
|
|
3066
3066
|
|
|
3067
3067
|
// Sign long message
|
|
3068
3068
|
const sig = try kp.sign(&long_message, null);
|
|
@@ -3209,7 +3209,7 @@ test "KeyPair API - generate and sign" {
|
|
|
3209
3209
|
|
|
3210
3210
|
test "KeyPair API - generateDeterministic" {
|
|
3211
3211
|
// Test deterministic key generation
|
|
3212
|
-
const seed
|
|
3212
|
+
const seed: [32]u8 = @splat(42);
|
|
3213
3213
|
const kp1 = try MLDSA44.KeyPair.generateDeterministic(seed);
|
|
3214
3214
|
const kp2 = try MLDSA44.KeyPair.generateDeterministic(seed);
|
|
3215
3215
|
|
|
@@ -3240,7 +3240,7 @@ test "Signature verification with noise" {
|
|
|
3240
3240
|
const msg = "Message to be signed with randomness";
|
|
3241
3241
|
|
|
3242
3242
|
// Create some noise
|
|
3243
|
-
const noise = [_]u8{ 1, 2, 3, 4, 5 } ++ [
|
|
3243
|
+
const noise = [_]u8{ 1, 2, 3, 4, 5 } ++ @as([27]u8, @splat(0));
|
|
3244
3244
|
|
|
3245
3245
|
// Sign with noise
|
|
3246
3246
|
const sig = try kp.sign(msg, noise);
|
|
@@ -3262,7 +3262,7 @@ test "Signature verification failure" {
|
|
|
3262
3262
|
}
|
|
3263
3263
|
|
|
3264
3264
|
test "Streaming API - sign and verify" {
|
|
3265
|
-
const seed
|
|
3265
|
+
const seed: [32]u8 = @splat(0x55);
|
|
3266
3266
|
const kp = try MLDSA44.KeyPair.generateDeterministic(seed);
|
|
3267
3267
|
|
|
3268
3268
|
const msg = "Test message for streaming API";
|
|
@@ -3279,7 +3279,7 @@ test "Streaming API - sign and verify" {
|
|
|
3279
3279
|
}
|
|
3280
3280
|
|
|
3281
3281
|
test "Streaming API - chunked message" {
|
|
3282
|
-
const seed
|
|
3282
|
+
const seed: [32]u8 = @splat(0x66);
|
|
3283
3283
|
const kp = try MLDSA44.KeyPair.generateDeterministic(seed);
|
|
3284
3284
|
|
|
3285
3285
|
// Create a message in chunks
|
|
@@ -3313,7 +3313,7 @@ test "Streaming API - chunked message" {
|
|
|
3313
3313
|
}
|
|
3314
3314
|
|
|
3315
3315
|
test "Streaming API - large message" {
|
|
3316
|
-
const seed
|
|
3316
|
+
const seed: [32]u8 = @splat(0x77);
|
|
3317
3317
|
const kp = try MLDSA44.KeyPair.generateDeterministic(seed);
|
|
3318
3318
|
|
|
3319
3319
|
// Create a large message (1MB)
|
|
@@ -3344,7 +3344,7 @@ test "Streaming API - all parameter sets" {
|
|
|
3344
3344
|
|
|
3345
3345
|
// ML-DSA-44
|
|
3346
3346
|
{
|
|
3347
|
-
const seed
|
|
3347
|
+
const seed: [32]u8 = @splat(0x44);
|
|
3348
3348
|
const kp = try MLDSA44.KeyPair.generateDeterministic(seed);
|
|
3349
3349
|
var signer = try kp.signer(null);
|
|
3350
3350
|
signer.update(test_msg);
|
|
@@ -3356,7 +3356,7 @@ test "Streaming API - all parameter sets" {
|
|
|
3356
3356
|
|
|
3357
3357
|
// ML-DSA-65
|
|
3358
3358
|
{
|
|
3359
|
-
const seed
|
|
3359
|
+
const seed: [32]u8 = @splat(0x65);
|
|
3360
3360
|
const kp = try MLDSA65.KeyPair.generateDeterministic(seed);
|
|
3361
3361
|
var signer = try kp.signer(null);
|
|
3362
3362
|
signer.update(test_msg);
|
|
@@ -3368,7 +3368,7 @@ test "Streaming API - all parameter sets" {
|
|
|
3368
3368
|
|
|
3369
3369
|
// ML-DSA-87
|
|
3370
3370
|
{
|
|
3371
|
-
const seed
|
|
3371
|
+
const seed: [32]u8 = @splat(0x87);
|
|
3372
3372
|
const kp = try MLDSA87.KeyPair.generateDeterministic(seed);
|
|
3373
3373
|
var signer = try kp.signer(null);
|
|
3374
3374
|
signer.update(test_msg);
|
package/std/crypto/ml_kem.zig
CHANGED
|
@@ -615,7 +615,7 @@ const inv_ntt_reductions = [_]i16{
|
|
|
615
615
|
test "invNTTReductions bounds" {
|
|
616
616
|
// Checks whether the reductions proposed by invNTTReductions
|
|
617
617
|
// don't overflow during invNTT().
|
|
618
|
-
var xs
|
|
618
|
+
var xs: [256]i32 = @splat(1); // start at |x| ≤ q
|
|
619
619
|
|
|
620
620
|
var r: usize = 0;
|
|
621
621
|
var layer: math.Log2Int(usize) = 1;
|
|
@@ -797,7 +797,7 @@ const Poly = struct {
|
|
|
797
797
|
cs: [N]i16,
|
|
798
798
|
|
|
799
799
|
const encoded_length = N / 2 * 3;
|
|
800
|
-
const zero: Poly = .{ .cs =
|
|
800
|
+
const zero: Poly = .{ .cs = @splat(0) };
|
|
801
801
|
|
|
802
802
|
// Add two polynomials (coefficients not normalized)
|
|
803
803
|
fn add(a: Poly, b: Poly) Poly {
|
|
@@ -1011,7 +1011,7 @@ const Poly = struct {
|
|
|
1011
1011
|
|
|
1012
1012
|
const out_length: usize = comptime @divTrunc(N * d, 8);
|
|
1013
1013
|
comptime assert(out_length * 8 == d * N);
|
|
1014
|
-
var out
|
|
1014
|
+
var out: [out_length]u8 = @splat(0);
|
|
1015
1015
|
|
|
1016
1016
|
while (in_off < N) {
|
|
1017
1017
|
// First we compress into in.
|
|
@@ -1754,7 +1754,7 @@ const NistDRBG = struct {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
|
|
1756
1756
|
fn init(seed: [48]u8) NistDRBG {
|
|
1757
|
-
var ret: NistDRBG = .{ .key =
|
|
1757
|
+
var ret: NistDRBG = .{ .key = @splat(0), .v = @splat(0) };
|
|
1758
1758
|
ret.update(seed);
|
|
1759
1759
|
return ret;
|
|
1760
1760
|
}
|
package/std/crypto/modes.zig
CHANGED
|
@@ -183,7 +183,7 @@ test "ctr mode" {
|
|
|
183
183
|
// Test 9: Large input (> 2*block_length, 100 bytes)
|
|
184
184
|
{
|
|
185
185
|
// Create a 100-byte input by extending with zeros
|
|
186
|
-
var in: [100]u8 =
|
|
186
|
+
var in: [100]u8 = @splat(0);
|
|
187
187
|
@memcpy(in[0..64], &[_]u8{
|
|
188
188
|
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
|
189
189
|
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
package/std/crypto/pbkdf2.zig
CHANGED
|
@@ -196,19 +196,19 @@ const ScalarDouble = struct {
|
|
|
196
196
|
}
|
|
197
197
|
var t = ScalarDouble{ .x1 = undefined, .x2 = Fe.zero, .x3 = Fe.zero };
|
|
198
198
|
{
|
|
199
|
-
var b
|
|
199
|
+
var b: [encoded_length]u8 = @splat(0);
|
|
200
200
|
const len = @min(s.len, 24);
|
|
201
201
|
b[0..len].* = s[0..len].*;
|
|
202
202
|
t.x1 = Fe.fromBytes(b, .little) catch unreachable;
|
|
203
203
|
}
|
|
204
204
|
if (s_.len >= 24) {
|
|
205
|
-
var b
|
|
205
|
+
var b: [encoded_length]u8 = @splat(0);
|
|
206
206
|
const len = @min(s.len - 24, 24);
|
|
207
207
|
b[0..len].* = s[24..][0..len].*;
|
|
208
208
|
t.x2 = Fe.fromBytes(b, .little) catch unreachable;
|
|
209
209
|
}
|
|
210
210
|
if (s_.len >= 48) {
|
|
211
|
-
var b
|
|
211
|
+
var b: [encoded_length]u8 = @splat(0);
|
|
212
212
|
const len = s.len - 48;
|
|
213
213
|
b[0..len].* = s[48..][0..len].*;
|
|
214
214
|
t.x3 = Fe.fromBytes(b, .little) catch unreachable;
|
|
@@ -184,13 +184,13 @@ const ScalarDouble = struct {
|
|
|
184
184
|
}
|
|
185
185
|
var t = ScalarDouble{ .x1 = undefined, .x2 = Fe.zero };
|
|
186
186
|
{
|
|
187
|
-
var b
|
|
187
|
+
var b: [encoded_length]u8 = @splat(0);
|
|
188
188
|
const len = @min(s.len, 32);
|
|
189
189
|
b[0..len].* = s[0..len].*;
|
|
190
190
|
t.x1 = Fe.fromBytes(b, .little) catch unreachable;
|
|
191
191
|
}
|
|
192
192
|
if (s_.len >= 32) {
|
|
193
|
-
var b
|
|
193
|
+
var b: [encoded_length]u8 = @splat(0);
|
|
194
194
|
const len = @min(s.len - 32, 32);
|
|
195
195
|
b[0..len].* = s[32..][0..len].*;
|
|
196
196
|
t.x2 = Fe.fromBytes(b, .little) catch unreachable;
|
|
@@ -196,19 +196,19 @@ const ScalarDouble = struct {
|
|
|
196
196
|
}
|
|
197
197
|
var t = ScalarDouble{ .x1 = undefined, .x2 = Fe.zero, .x3 = Fe.zero };
|
|
198
198
|
{
|
|
199
|
-
var b
|
|
199
|
+
var b: [encoded_length]u8 = @splat(0);
|
|
200
200
|
const len = @min(s.len, 24);
|
|
201
201
|
b[0..len].* = s[0..len].*;
|
|
202
202
|
t.x1 = Fe.fromBytes(b, .little) catch unreachable;
|
|
203
203
|
}
|
|
204
204
|
if (s_.len >= 24) {
|
|
205
|
-
var b
|
|
205
|
+
var b: [encoded_length]u8 = @splat(0);
|
|
206
206
|
const len = @min(s.len - 24, 24);
|
|
207
207
|
b[0..len].* = s[24..][0..len].*;
|
|
208
208
|
t.x2 = Fe.fromBytes(b, .little) catch unreachable;
|
|
209
209
|
}
|
|
210
210
|
if (s_.len >= 48) {
|
|
211
|
-
var b
|
|
211
|
+
var b: [encoded_length]u8 = @splat(0);
|
|
212
212
|
const len = s.len - 48;
|
|
213
213
|
b[0..len].* = s[48..][0..len].*;
|
|
214
214
|
t.x3 = Fe.fromBytes(b, .little) catch unreachable;
|
|
@@ -97,7 +97,7 @@ test "p256 public key is the neutral element (public verification)" {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
test "p256 field element non-canonical encoding" {
|
|
100
|
-
const s
|
|
100
|
+
const s: [32]u8 = @splat(0xff);
|
|
101
101
|
try testing.expectError(error.NonCanonical, P256.Fe.fromBytes(s, .little));
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -110,8 +110,8 @@ test "p256 neutral element decoding" {
|
|
|
110
110
|
test "p256 double base multiplication" {
|
|
111
111
|
const p1 = P256.basePoint;
|
|
112
112
|
const p2 = P256.basePoint.dbl();
|
|
113
|
-
const s1
|
|
114
|
-
const s2
|
|
113
|
+
const s1: [32]u8 = @splat(0x01);
|
|
114
|
+
const s2: [32]u8 = @splat(0x02);
|
|
115
115
|
const pr1 = try P256.mulDoubleBasePublic(p1, s1, p2, s2, .little);
|
|
116
116
|
const pr2 = (try p1.mul(s1, .little)).add(try p2.mul(s2, .little));
|
|
117
117
|
try testing.expect(pr1.equivalent(pr2));
|
|
@@ -120,8 +120,8 @@ test "p256 double base multiplication" {
|
|
|
120
120
|
test "p256 double base multiplication with large scalars" {
|
|
121
121
|
const p1 = P256.basePoint;
|
|
122
122
|
const p2 = P256.basePoint.dbl();
|
|
123
|
-
const s1
|
|
124
|
-
const s2
|
|
123
|
+
const s1: [32]u8 = @splat(0xee);
|
|
124
|
+
const s2: [32]u8 = @splat(0xdd);
|
|
125
125
|
const pr1 = try P256.mulDoubleBasePublic(p1, s1, p2, s2, .little);
|
|
126
126
|
const pr2 = (try p1.mul(s1, .little)).add(try p2.mul(s2, .little));
|
|
127
127
|
try testing.expect(pr1.equivalent(pr2));
|
|
@@ -100,7 +100,7 @@ test "p384 public key is the neutral element (public verification)" {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
test "p384 field element non-canonical encoding" {
|
|
103
|
-
const s
|
|
103
|
+
const s: [48]u8 = @splat(0xff);
|
|
104
104
|
try testing.expectError(error.NonCanonical, P384.Fe.fromBytes(s, .little));
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -113,8 +113,8 @@ test "p384 neutral element decoding" {
|
|
|
113
113
|
test "p384 double base multiplication" {
|
|
114
114
|
const p1 = P384.basePoint;
|
|
115
115
|
const p2 = P384.basePoint.dbl();
|
|
116
|
-
const s1
|
|
117
|
-
const s2
|
|
116
|
+
const s1: [48]u8 = @splat(0x01);
|
|
117
|
+
const s2: [48]u8 = @splat(0x02);
|
|
118
118
|
const pr1 = try P384.mulDoubleBasePublic(p1, s1, p2, s2, .little);
|
|
119
119
|
const pr2 = (try p1.mul(s1, .little)).add(try p2.mul(s2, .little));
|
|
120
120
|
try testing.expect(pr1.equivalent(pr2));
|
|
@@ -123,8 +123,8 @@ test "p384 double base multiplication" {
|
|
|
123
123
|
test "p384 double base multiplication with large scalars" {
|
|
124
124
|
const p1 = P384.basePoint;
|
|
125
125
|
const p2 = P384.basePoint.dbl();
|
|
126
|
-
const s1
|
|
127
|
-
const s2
|
|
126
|
+
const s1: [48]u8 = @splat(0xee);
|
|
127
|
+
const s2: [48]u8 = @splat(0xdd);
|
|
128
128
|
const pr1 = try P384.mulDoubleBasePublic(p1, s1, p2, s2, .little);
|
|
129
129
|
const pr2 = (try p1.mul(s1, .little)).add(try p2.mul(s2, .little));
|
|
130
130
|
try testing.expect(pr1.equivalent(pr2));
|
|
@@ -109,7 +109,7 @@ test "secp256k1 public key is the neutral element (public verification)" {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
test "secp256k1 field element non-canonical encoding" {
|
|
112
|
-
const s
|
|
112
|
+
const s: [32]u8 = @splat(0xff);
|
|
113
113
|
try testing.expectError(error.NonCanonical, Secp256k1.Fe.fromBytes(s, .little));
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -122,8 +122,8 @@ test "secp256k1 neutral element decoding" {
|
|
|
122
122
|
test "secp256k1 double base multiplication" {
|
|
123
123
|
const p1 = Secp256k1.basePoint;
|
|
124
124
|
const p2 = Secp256k1.basePoint.dbl();
|
|
125
|
-
const s1
|
|
126
|
-
const s2
|
|
125
|
+
const s1: [32]u8 = @splat(0x01);
|
|
126
|
+
const s2: [32]u8 = @splat(0x02);
|
|
127
127
|
const pr1 = try Secp256k1.mulDoubleBasePublic(p1, s1, p2, s2, .little);
|
|
128
128
|
const pr2 = (try p1.mul(s1, .little)).add(try p2.mul(s2, .little));
|
|
129
129
|
try testing.expect(pr1.equivalent(pr2));
|
package/std/crypto/salsa20.zig
CHANGED
|
@@ -384,7 +384,7 @@ pub const XSalsa20Poly1305 = struct {
|
|
|
384
384
|
pub fn encrypt(c: []u8, tag: *[tag_length]u8, m: []const u8, ad: []const u8, npub: [nonce_length]u8, k: [key_length]u8) void {
|
|
385
385
|
debug.assert(c.len == m.len);
|
|
386
386
|
const extended = extend(rounds, k, npub);
|
|
387
|
-
var block0
|
|
387
|
+
var block0: [64]u8 = @splat(0);
|
|
388
388
|
const mlen0 = @min(32, m.len);
|
|
389
389
|
@memcpy(block0[32..][0..mlen0], m[0..mlen0]);
|
|
390
390
|
Salsa20.xor(block0[0..], block0[0..], 0, extended.key, extended.nonce);
|
|
@@ -408,7 +408,7 @@ pub const XSalsa20Poly1305 = struct {
|
|
|
408
408
|
pub fn decrypt(m: []u8, c: []const u8, tag: [tag_length]u8, ad: []const u8, npub: [nonce_length]u8, k: [key_length]u8) AuthenticationError!void {
|
|
409
409
|
debug.assert(c.len == m.len);
|
|
410
410
|
const extended = extend(rounds, k, npub);
|
|
411
|
-
var block0
|
|
411
|
+
var block0: [64]u8 = @splat(0);
|
|
412
412
|
const mlen0 = @min(32, c.len);
|
|
413
413
|
@memcpy(block0[32..][0..mlen0], c[0..mlen0]);
|
|
414
414
|
Salsa20.xor(block0[0..], block0[0..], 0, extended.key, extended.nonce);
|
|
@@ -489,7 +489,7 @@ pub const Box = struct {
|
|
|
489
489
|
/// Compute a secret suitable for `secretbox` given a recipient's public key and a sender's secret key.
|
|
490
490
|
pub fn createSharedSecret(public_key: [public_length]u8, secret_key: [secret_length]u8) (IdentityElementError || WeakPublicKeyError)![shared_length]u8 {
|
|
491
491
|
const p = try X25519.scalarmult(secret_key, public_key);
|
|
492
|
-
const zero
|
|
492
|
+
const zero: [16]u8 = @splat(0);
|
|
493
493
|
return SalsaImpl(20).hsalsa(zero, p);
|
|
494
494
|
}
|
|
495
495
|
|
|
@@ -559,15 +559,15 @@ const htest = @import("test.zig");
|
|
|
559
559
|
test "(x)salsa20" {
|
|
560
560
|
if (builtin.cpu.has(.riscv, .v) and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/24299
|
|
561
561
|
|
|
562
|
-
const key
|
|
563
|
-
const nonce
|
|
564
|
-
const msg
|
|
562
|
+
const key: [32]u8 = @splat(0x69);
|
|
563
|
+
const nonce: [8]u8 = @splat(0x42);
|
|
564
|
+
const msg: [20]u8 = @splat(0);
|
|
565
565
|
var c: [msg.len]u8 = undefined;
|
|
566
566
|
|
|
567
567
|
Salsa20.xor(&c, msg[0..], 0, key, nonce);
|
|
568
568
|
try htest.assertEqual("30ff9933aa6534ff5207142593cd1fca4b23bdd8", c[0..]);
|
|
569
569
|
|
|
570
|
-
const extended_nonce
|
|
570
|
+
const extended_nonce: [24]u8 = @splat(0x42);
|
|
571
571
|
XSalsa20.xor(&c, msg[0..], 0, key, extended_nonce);
|
|
572
572
|
try htest.assertEqual("b4ab7d82e750ec07644fa3281bce6cd91d4243f9", c[0..]);
|
|
573
573
|
}
|
|
@@ -637,7 +637,7 @@ test "xsalsa20poly1305 sealedbox" {
|
|
|
637
637
|
test "secretbox twoblocks" {
|
|
638
638
|
const key = [_]u8{ 0xc9, 0xc9, 0x4d, 0xcf, 0x68, 0xbe, 0x00, 0xe4, 0x7f, 0xe6, 0x13, 0x26, 0xfc, 0xc4, 0x2f, 0xd0, 0xdb, 0x93, 0x91, 0x1c, 0x09, 0x94, 0x89, 0xe1, 0x1b, 0x88, 0x63, 0x18, 0x86, 0x64, 0x8b, 0x7b };
|
|
639
639
|
const nonce = [_]u8{ 0xa4, 0x33, 0xe9, 0x0a, 0x07, 0x68, 0x6e, 0x9a, 0x2b, 0x6d, 0xd4, 0x59, 0x04, 0x72, 0x3e, 0xd3, 0x8a, 0x67, 0x55, 0xc7, 0x9e, 0x3e, 0x77, 0xdc };
|
|
640
|
-
const msg
|
|
640
|
+
const msg: [97]u8 = @splat('a');
|
|
641
641
|
var ciphertext: [msg.len + SecretBox.tag_length]u8 = undefined;
|
|
642
642
|
SecretBox.seal(&ciphertext, &msg, nonce, key);
|
|
643
643
|
try htest.assertEqual("b05760e217288ba079caa2fd57fd3701784974ffcfda20fe523b89211ad8af065a6eb37cdb29d51aca5bd75dafdd21d18b044c54bb7c526cf576c94ee8900f911ceab0147e82b667a28c52d58ceb29554ff45471224d37b03256b01c119b89ff6d36855de8138d103386dbc9d971f52261", &ciphertext);
|
package/std/crypto/sha2.zig
CHANGED
|
@@ -461,7 +461,7 @@ test "sha256 streaming" {
|
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
test "sha256 aligned final" {
|
|
464
|
-
var block
|
|
464
|
+
var block: [Sha256.block_length]u8 = @splat(0);
|
|
465
465
|
var out: [Sha256.digest_length]u8 = undefined;
|
|
466
466
|
|
|
467
467
|
var h = Sha256.init(.{});
|
|
@@ -833,7 +833,7 @@ test "sha512 streaming" {
|
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
test "sha512 aligned final" {
|
|
836
|
-
var block
|
|
836
|
+
var block: [Sha512.block_length]u8 = @splat(0);
|
|
837
837
|
var out: [Sha512.digest_length]u8 = undefined;
|
|
838
838
|
|
|
839
839
|
var h = Sha512.init(.{});
|
package/std/crypto/sha3.zig
CHANGED
|
@@ -543,7 +543,7 @@ test "sha3-256 streaming" {
|
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
test "sha3-256 aligned final" {
|
|
546
|
-
var block
|
|
546
|
+
var block: [Sha3_256.block_length]u8 = @splat(0);
|
|
547
547
|
var out: [Sha3_256.digest_length]u8 = undefined;
|
|
548
548
|
|
|
549
549
|
var h = Sha3_256.init(.{});
|
|
@@ -616,7 +616,7 @@ test "sha3-512 streaming" {
|
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
test "sha3-512 aligned final" {
|
|
619
|
-
var block
|
|
619
|
+
var block: [Sha3_512.block_length]u8 = @splat(0);
|
|
620
620
|
var out: [Sha3_512.digest_length]u8 = undefined;
|
|
621
621
|
|
|
622
622
|
var h = Sha3_512.init(.{});
|
package/std/crypto/siphash.zig
CHANGED
|
@@ -91,7 +91,7 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round
|
|
|
91
91
|
|
|
92
92
|
self.msg_len +%= @as(u8, @truncate(b.len));
|
|
93
93
|
|
|
94
|
-
var buf
|
|
94
|
+
var buf: [8]u8 = @splat(0);
|
|
95
95
|
@memcpy(buf[0..b.len], b);
|
|
96
96
|
buf[7] = self.msg_len;
|
|
97
97
|
self.round(buf);
|