@zigc/lib 0.17.0-dev.228 → 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/compiler/build_runner.zig +1 -1
- package/compiler/reduce/Walk.zig +1 -6
- 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/ssp.zig +2 -2
- package/docs/wasm/Walk.zig +1 -3
- package/docs/wasm/html_render.zig +1 -2
- package/package.json +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 +7 -7
- package/std/c.zig +17 -17
- 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/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 +1 -1
- package/std/fmt/parse_float/decimal.zig +1 -1
- package/std/fmt.zig +5 -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/nextafter.zig +1 -2
- package/std/math/powi.zig +2 -3
- package/std/math/signbit.zig +0 -1
- package/std/math.zig +12 -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/tar/Writer.zig +39 -33
- package/std/tar.zig +8 -4
- 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
|
@@ -470,7 +470,7 @@ pub const Edwards25519 = struct {
|
|
|
470
470
|
st.final(&hctx);
|
|
471
471
|
xctx = hctx[0..];
|
|
472
472
|
}
|
|
473
|
-
const empty_block
|
|
473
|
+
const empty_block: [H.block_length]u8 = @splat(0);
|
|
474
474
|
var t = [3]u8{ 0, n * h_l, 0 };
|
|
475
475
|
var xctx_len_u8 = [1]u8{@as(u8, @intCast(xctx.len))};
|
|
476
476
|
var st = H.init(.{});
|
|
@@ -539,7 +539,7 @@ pub const Edwards25519 = struct {
|
|
|
539
539
|
const htest = @import("../test.zig");
|
|
540
540
|
|
|
541
541
|
test "packing/unpacking" {
|
|
542
|
-
const s = [
|
|
542
|
+
const s = [1]u8{170} ++ @as([31]u8, @splat(0));
|
|
543
543
|
var b = Edwards25519.basePoint;
|
|
544
544
|
const pk = try b.mul(s);
|
|
545
545
|
var buf: [128]u8 = undefined;
|
|
@@ -609,7 +609,7 @@ test "hash-to-curve operation" {
|
|
|
609
609
|
}
|
|
610
610
|
|
|
611
611
|
test "implicit reduction of invalid scalars" {
|
|
612
|
-
const s = [
|
|
612
|
+
const s = @as([31]u8, @splat(0)) ++ [1]u8{255};
|
|
613
613
|
const p1 = try Edwards25519.basePoint.mulPublic(s);
|
|
614
614
|
const p2 = try Edwards25519.basePoint.mul(s);
|
|
615
615
|
const p3 = try p1.mulPublic(s);
|
|
@@ -183,13 +183,13 @@ test "ristretto255" {
|
|
|
183
183
|
q = q.dbl().add(p);
|
|
184
184
|
try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&q.toBytes()}), "E882B131016B52C1D3337080187CF768423EFCCBB517BB495AB812C4160FF44E");
|
|
185
185
|
|
|
186
|
-
const s = [_]u8{15} ++ [
|
|
186
|
+
const s = [_]u8{15} ++ @as([31]u8, @splat(0));
|
|
187
187
|
const w = try p.mul(s);
|
|
188
188
|
try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&w.toBytes()}), "E0C418F7C8D9C4CDD7395B93EA124F3AD99021BB681DFC3302A9D99A2E53E64E");
|
|
189
189
|
|
|
190
190
|
try std.testing.expect(p.dbl().dbl().dbl().dbl().equivalent(w.add(p)));
|
|
191
191
|
|
|
192
|
-
const h = [
|
|
192
|
+
const h = @as([32]u8, @splat(69)) ++ @as([32]u8, @splat(42));
|
|
193
193
|
const ph = Ristretto255.fromUniform(h);
|
|
194
194
|
try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&ph.toBytes()}), "DCCA54E037A4311EFBEEF413ACD21D35276518970B7A61DC88F8587B493D5E19");
|
|
195
195
|
}
|
|
@@ -11,7 +11,7 @@ pub const field_order: u256 = 72370055773322622139731865630429942408571163593799
|
|
|
11
11
|
pub const CompressedScalar = [32]u8;
|
|
12
12
|
|
|
13
13
|
/// Zero
|
|
14
|
-
pub const zero
|
|
14
|
+
pub const zero: [32]u8 = @splat(0);
|
|
15
15
|
|
|
16
16
|
const field_order_s = s: {
|
|
17
17
|
var s: [32]u8 = undefined;
|
|
@@ -81,7 +81,7 @@ pub fn add(a: CompressedScalar, b: CompressedScalar) CompressedScalar {
|
|
|
81
81
|
|
|
82
82
|
/// Return -s (mod L)
|
|
83
83
|
pub fn neg(s: CompressedScalar) CompressedScalar {
|
|
84
|
-
const fs: [64]u8 = field_order_s ++ [
|
|
84
|
+
const fs: [64]u8 = field_order_s ++ @as([32]u8, @splat(0));
|
|
85
85
|
var sx: [64]u8 = undefined;
|
|
86
86
|
sx[0..32].* = s;
|
|
87
87
|
@memset(sx[32..], 0);
|
|
@@ -862,9 +862,9 @@ test "non-canonical scalar25519" {
|
|
|
862
862
|
}
|
|
863
863
|
|
|
864
864
|
test "mulAdd overflow check" {
|
|
865
|
-
const a: [32]u8 =
|
|
866
|
-
const b: [32]u8 =
|
|
867
|
-
const c: [32]u8 =
|
|
865
|
+
const a: [32]u8 = @splat(0xff);
|
|
866
|
+
const b: [32]u8 = @splat(0xff);
|
|
867
|
+
const c: [32]u8 = @splat(0xff);
|
|
868
868
|
const x = mulAdd(a, b, c);
|
|
869
869
|
var buf: [128]u8 = undefined;
|
|
870
870
|
try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&x}), "D14DF91389432C25AD60FF9791B9FD1D67BEF517D273ECCE3D9A307C1B419903");
|
|
@@ -886,7 +886,7 @@ test "random scalar" {
|
|
|
886
886
|
}
|
|
887
887
|
|
|
888
888
|
test "64-bit reduction" {
|
|
889
|
-
const bytes = field_order_s ++ [
|
|
889
|
+
const bytes = field_order_s ++ @as([32]u8, @splat(0));
|
|
890
890
|
const x = Scalar.fromBytes64(bytes);
|
|
891
891
|
try std.testing.expect(x.isZero());
|
|
892
892
|
}
|
|
@@ -181,7 +181,7 @@ test "rfc7748 1,000,000 iterations" {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
test "edwards25519 -> curve25519 map" {
|
|
184
|
-
const ed_kp = try crypto.sign.Ed25519.KeyPair.generateDeterministic(
|
|
184
|
+
const ed_kp = try crypto.sign.Ed25519.KeyPair.generateDeterministic(@splat(0x42));
|
|
185
185
|
const mont_kp = try X25519.KeyPair.fromEd25519(ed_kp);
|
|
186
186
|
try htest.assertEqual("90e7595fc89e52fdfddce9c6a43d74dbf6047025ee0462d2d172e8b6a2841d6e", &mont_kp.secret_key);
|
|
187
187
|
try htest.assertEqual("cc4f2cdb695dd766f34118eb67b98652fed1d8bc49c330b119bbfa8a64989378", &mont_kp.public_key);
|
|
@@ -1092,7 +1092,7 @@ pub const rsa = struct {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
var m_p_buf: [8 + Hash.digest_length + Hash.digest_length]u8 = undefined;
|
|
1094
1094
|
var m_p = m_p_buf[0 .. 8 + Hash.digest_length + sLen];
|
|
1095
|
-
std.mem.copyForwards(u8, m_p,
|
|
1095
|
+
std.mem.copyForwards(u8, m_p, @as(*const [8]u8, &@splat(0)));
|
|
1096
1096
|
std.mem.copyForwards(u8, m_p[8..], &mHash);
|
|
1097
1097
|
std.mem.copyForwards(u8, m_p[(8 + Hash.digest_length)..], salt);
|
|
1098
1098
|
|
package/std/crypto/Sha1.zig
CHANGED
package/std/crypto/aegis.zig
CHANGED
|
@@ -55,6 +55,14 @@ pub const Aegis256X2_256 = Aegis256XGeneric(2, 256);
|
|
|
55
55
|
/// AEGIS-256 with a 256 bit tag
|
|
56
56
|
pub const Aegis256_256 = Aegis256XGeneric(1, 256);
|
|
57
57
|
|
|
58
|
+
/// `inline` to avoid needless binary bloat from generic instantiations since the arguments are
|
|
59
|
+
/// usually comptime-known and the function is a trivial leaf function.
|
|
60
|
+
inline fn repeat16u8(comptime count: usize, part: [16]u8) [16 * count]u8 {
|
|
61
|
+
const buf: [count][part.len]u8 = @splat(part);
|
|
62
|
+
const ptr: *const [16 * count]u8 = @ptrCast(&buf);
|
|
63
|
+
return ptr.*;
|
|
64
|
+
}
|
|
65
|
+
|
|
58
66
|
fn State128X(comptime degree: u7) type {
|
|
59
67
|
return struct {
|
|
60
68
|
const AesBlockVec = crypto.core.aes.BlockVec(degree);
|
|
@@ -67,10 +75,10 @@ fn State128X(comptime degree: u7) type {
|
|
|
67
75
|
const alignment = AesBlockVec.native_word_size;
|
|
68
76
|
|
|
69
77
|
fn init(key: [16]u8, nonce: [16]u8) State {
|
|
70
|
-
const c1 = AesBlockVec.fromBytes(&
|
|
71
|
-
const c2 = AesBlockVec.fromBytes(&
|
|
72
|
-
const key_block = AesBlockVec.fromBytes(&(key
|
|
73
|
-
const nonce_block = AesBlockVec.fromBytes(&(nonce
|
|
78
|
+
const c1 = AesBlockVec.fromBytes(&repeat16u8(degree, .{ 0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f, 0xf1, 0x20, 0x11, 0x31, 0x42, 0x73, 0xb5, 0x28, 0xdd }));
|
|
79
|
+
const c2 = AesBlockVec.fromBytes(&repeat16u8(degree, .{ 0x0, 0x1, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0d, 0x15, 0x22, 0x37, 0x59, 0x90, 0xe9, 0x79, 0x62 }));
|
|
80
|
+
const key_block = AesBlockVec.fromBytes(&repeat16u8(degree, key));
|
|
81
|
+
const nonce_block = AesBlockVec.fromBytes(&repeat16u8(degree, nonce));
|
|
74
82
|
const blocks = [8]AesBlockVec{
|
|
75
83
|
key_block.xorBlocks(nonce_block),
|
|
76
84
|
c1,
|
|
@@ -84,7 +92,7 @@ fn State128X(comptime degree: u7) type {
|
|
|
84
92
|
var state = State{ .blocks = blocks };
|
|
85
93
|
if (degree > 1) {
|
|
86
94
|
const context_block = ctx: {
|
|
87
|
-
var contexts_bytes
|
|
95
|
+
var contexts_bytes: [aes_block_length]u8 = @splat(0);
|
|
88
96
|
for (0..degree) |i| {
|
|
89
97
|
contexts_bytes[i * 16] = @intCast(i);
|
|
90
98
|
contexts_bytes[i * 16 + 1] = @intCast(degree - 1);
|
|
@@ -150,7 +158,7 @@ fn State128X(comptime degree: u7) type {
|
|
|
150
158
|
const blocks = &state.blocks;
|
|
151
159
|
const z0 = blocks[6].xorBlocks(blocks[1]).xorBlocks(blocks[2].andBlocks(blocks[3]));
|
|
152
160
|
const z1 = blocks[2].xorBlocks(blocks[5]).xorBlocks(blocks[6].andBlocks(blocks[7]));
|
|
153
|
-
var pad
|
|
161
|
+
var pad: [rate]u8 = @splat(0);
|
|
154
162
|
pad[0..aes_block_length].* = z0.toBytes();
|
|
155
163
|
pad[aes_block_length..].* = z1.toBytes();
|
|
156
164
|
for (pad[0..src.len], src) |*p, x| p.* ^= x;
|
|
@@ -214,7 +222,7 @@ fn State128X(comptime degree: u7) type {
|
|
|
214
222
|
state.update(t, t);
|
|
215
223
|
}
|
|
216
224
|
if (degree > 1) {
|
|
217
|
-
var v
|
|
225
|
+
var v: [rate]u8 = @splat(0);
|
|
218
226
|
switch (tag_bits) {
|
|
219
227
|
128 => {
|
|
220
228
|
const tags = blocks[0].xorBlocks(blocks[1]).xorBlocks(blocks[2]).xorBlocks(blocks[3]).xorBlocks(blocks[4]).xorBlocks(blocks[5]).xorBlocks(blocks[6]).toBytes();
|
|
@@ -362,12 +370,12 @@ fn State256X(comptime degree: u7) type {
|
|
|
362
370
|
const alignment = AesBlockVec.native_word_size;
|
|
363
371
|
|
|
364
372
|
fn init(key: [32]u8, nonce: [32]u8) State {
|
|
365
|
-
const c1 = AesBlockVec.fromBytes(&
|
|
366
|
-
const c2 = AesBlockVec.fromBytes(&
|
|
367
|
-
const key_block1 = AesBlockVec.fromBytes(key[0..16]
|
|
368
|
-
const key_block2 = AesBlockVec.fromBytes(key[16..32]
|
|
369
|
-
const nonce_block1 = AesBlockVec.fromBytes(nonce[0..16]
|
|
370
|
-
const nonce_block2 = AesBlockVec.fromBytes(nonce[16..32]
|
|
373
|
+
const c1 = AesBlockVec.fromBytes(&repeat16u8(degree, .{ 0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f, 0xf1, 0x20, 0x11, 0x31, 0x42, 0x73, 0xb5, 0x28, 0xdd }));
|
|
374
|
+
const c2 = AesBlockVec.fromBytes(&repeat16u8(degree, .{ 0x0, 0x1, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0d, 0x15, 0x22, 0x37, 0x59, 0x90, 0xe9, 0x79, 0x62 }));
|
|
375
|
+
const key_block1 = AesBlockVec.fromBytes(&repeat16u8(degree, key[0..16].*));
|
|
376
|
+
const key_block2 = AesBlockVec.fromBytes(&repeat16u8(degree, key[16..32].*));
|
|
377
|
+
const nonce_block1 = AesBlockVec.fromBytes(&repeat16u8(degree, nonce[0..16].*));
|
|
378
|
+
const nonce_block2 = AesBlockVec.fromBytes(&repeat16u8(degree, nonce[16..32].*));
|
|
371
379
|
const kxn1 = key_block1.xorBlocks(nonce_block1);
|
|
372
380
|
const kxn2 = key_block2.xorBlocks(nonce_block2);
|
|
373
381
|
const blocks = [6]AesBlockVec{
|
|
@@ -381,7 +389,7 @@ fn State256X(comptime degree: u7) type {
|
|
|
381
389
|
var state = State{ .blocks = blocks };
|
|
382
390
|
if (degree > 1) {
|
|
383
391
|
const context_block = ctx: {
|
|
384
|
-
var contexts_bytes
|
|
392
|
+
var contexts_bytes: [aes_block_length]u8 = @splat(0);
|
|
385
393
|
for (0..degree) |i| {
|
|
386
394
|
contexts_bytes[i * 16] = @intCast(i);
|
|
387
395
|
contexts_bytes[i * 16 + 1] = @intCast(degree - 1);
|
|
@@ -509,7 +517,7 @@ fn State256X(comptime degree: u7) type {
|
|
|
509
517
|
state.update(t);
|
|
510
518
|
}
|
|
511
519
|
if (degree > 1) {
|
|
512
|
-
var v
|
|
520
|
+
var v: [rate]u8 = @splat(0);
|
|
513
521
|
switch (tag_bits) {
|
|
514
522
|
128 => {
|
|
515
523
|
const tags = blocks[0].xorBlocks(blocks[1]).xorBlocks(blocks[2]).xorBlocks(blocks[3]).xorBlocks(blocks[4]).xorBlocks(blocks[5]).toBytes();
|
|
@@ -746,9 +754,7 @@ fn AegisMac(comptime T: type) type {
|
|
|
746
754
|
|
|
747
755
|
/// Initialize a state for the MAC function, with a default nonce
|
|
748
756
|
pub fn init(key: *const [key_length]u8) Mac {
|
|
749
|
-
return
|
|
750
|
-
.state = T.State.init(key.*, [_]u8{0} ** nonce_length),
|
|
751
|
-
};
|
|
757
|
+
return .{ .state = .init(key.*, @splat(0)) };
|
|
752
758
|
}
|
|
753
759
|
|
|
754
760
|
/// Add data to the state
|
|
@@ -781,7 +787,7 @@ fn AegisMac(comptime T: type) type {
|
|
|
781
787
|
/// Return an authentication tag for the current state
|
|
782
788
|
pub fn final(self: *Mac, out: *[mac_length]u8) void {
|
|
783
789
|
if (self.off > 0) {
|
|
784
|
-
var pad
|
|
790
|
+
var pad: [block_length]u8 = @splat(0);
|
|
785
791
|
@memcpy(pad[0..self.off], self.buf[0..self.off]);
|
|
786
792
|
self.state.absorb(&pad);
|
|
787
793
|
}
|
|
@@ -808,8 +814,8 @@ const htest = @import("test.zig");
|
|
|
808
814
|
const testing = std.testing;
|
|
809
815
|
|
|
810
816
|
test "Aegis128L test vector 1" {
|
|
811
|
-
const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [
|
|
812
|
-
const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [
|
|
817
|
+
const key: [Aegis128L.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ @as([14]u8, @splat(0x00));
|
|
818
|
+
const nonce: [Aegis128L.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ @as([13]u8, @splat(0x00));
|
|
813
819
|
const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
|
|
814
820
|
const m = [32]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
|
|
815
821
|
var c: [m.len]u8 = undefined;
|
|
@@ -831,10 +837,10 @@ test "Aegis128L test vector 1" {
|
|
|
831
837
|
}
|
|
832
838
|
|
|
833
839
|
test "Aegis128L test vector 2" {
|
|
834
|
-
const key: [Aegis128L.key_length]u8 =
|
|
835
|
-
const nonce: [Aegis128L.nonce_length]u8 =
|
|
836
|
-
const ad
|
|
837
|
-
const m
|
|
840
|
+
const key: [Aegis128L.key_length]u8 = @splat(0x00);
|
|
841
|
+
const nonce: [Aegis128L.nonce_length]u8 = @splat(0x00);
|
|
842
|
+
const ad: [0]u8 = .{};
|
|
843
|
+
const m: [16]u8 = @splat(0x00);
|
|
838
844
|
var c: [m.len]u8 = undefined;
|
|
839
845
|
var m2: [m.len]u8 = undefined;
|
|
840
846
|
var tag: [Aegis128L.tag_length]u8 = undefined;
|
|
@@ -848,8 +854,8 @@ test "Aegis128L test vector 2" {
|
|
|
848
854
|
}
|
|
849
855
|
|
|
850
856
|
test "Aegis128L test vector 3" {
|
|
851
|
-
const key: [Aegis128L.key_length]u8 =
|
|
852
|
-
const nonce: [Aegis128L.nonce_length]u8 =
|
|
857
|
+
const key: [Aegis128L.key_length]u8 = @splat(0x00);
|
|
858
|
+
const nonce: [Aegis128L.nonce_length]u8 = @splat(0x00);
|
|
853
859
|
const ad = [_]u8{};
|
|
854
860
|
const m = [_]u8{};
|
|
855
861
|
var c: [m.len]u8 = undefined;
|
|
@@ -881,8 +887,8 @@ test "Aegis128X2 test vector 1" {
|
|
|
881
887
|
}
|
|
882
888
|
|
|
883
889
|
test "Aegis256 test vector 1" {
|
|
884
|
-
const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ [
|
|
885
|
-
const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ [
|
|
890
|
+
const key: [Aegis256.key_length]u8 = [_]u8{ 0x10, 0x01 } ++ @as([30]u8, @splat(0x00));
|
|
891
|
+
const nonce: [Aegis256.nonce_length]u8 = [_]u8{ 0x10, 0x00, 0x02 } ++ @as([29]u8, @splat(0x00));
|
|
886
892
|
const ad = [8]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 };
|
|
887
893
|
const m = [32]u8{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
|
|
888
894
|
var c: [m.len]u8 = undefined;
|
|
@@ -904,10 +910,10 @@ test "Aegis256 test vector 1" {
|
|
|
904
910
|
}
|
|
905
911
|
|
|
906
912
|
test "Aegis256 test vector 2" {
|
|
907
|
-
const key: [Aegis256.key_length]u8 =
|
|
908
|
-
const nonce: [Aegis256.nonce_length]u8 =
|
|
913
|
+
const key: [Aegis256.key_length]u8 = @splat(0x00);
|
|
914
|
+
const nonce: [Aegis256.nonce_length]u8 = @splat(0x00);
|
|
909
915
|
const ad = [_]u8{};
|
|
910
|
-
const m
|
|
916
|
+
const m: [16]u8 = @splat(0x00);
|
|
911
917
|
var c: [m.len]u8 = undefined;
|
|
912
918
|
var m2: [m.len]u8 = undefined;
|
|
913
919
|
var tag: [Aegis256.tag_length]u8 = undefined;
|
|
@@ -921,8 +927,8 @@ test "Aegis256 test vector 2" {
|
|
|
921
927
|
}
|
|
922
928
|
|
|
923
929
|
test "Aegis256 test vector 3" {
|
|
924
|
-
const key: [Aegis256.key_length]u8 =
|
|
925
|
-
const nonce: [Aegis256.nonce_length]u8 =
|
|
930
|
+
const key: [Aegis256.key_length]u8 = @splat(0x00);
|
|
931
|
+
const nonce: [Aegis256.nonce_length]u8 = @splat(0x00);
|
|
926
932
|
const ad = [_]u8{};
|
|
927
933
|
const m = [_]u8{};
|
|
928
934
|
var c: [m.len]u8 = undefined;
|
|
@@ -954,7 +960,7 @@ test "Aegis256X4 test vector 1" {
|
|
|
954
960
|
}
|
|
955
961
|
|
|
956
962
|
test "Aegis MAC" {
|
|
957
|
-
const key
|
|
963
|
+
const key: [Aegis128LMac.key_length]u8 = @splat(0x00);
|
|
958
964
|
var msg: [64]u8 = undefined;
|
|
959
965
|
for (&msg, 0..) |*m, i| {
|
|
960
966
|
m.* = @as(u8, @truncate(i));
|
|
@@ -989,8 +995,8 @@ test "Aegis MAC" {
|
|
|
989
995
|
}
|
|
990
996
|
|
|
991
997
|
test "AEGISMAC-128* test vectors" {
|
|
992
|
-
const key = [_]u8{ 0x10, 0x01 } ++ [
|
|
993
|
-
const nonce = [_]u8{ 0x10, 0x00, 0x02 } ++ [
|
|
998
|
+
const key = [_]u8{ 0x10, 0x01 } ++ @as([16 - 2]u8, @splat(0x00));
|
|
999
|
+
const nonce = [_]u8{ 0x10, 0x00, 0x02 } ++ @as([16 - 3]u8, @splat(0x00));
|
|
994
1000
|
var msg: [35]u8 = undefined;
|
|
995
1001
|
for (&msg, 0..) |*byte, i| byte.* = @truncate(i);
|
|
996
1002
|
var mac128: [16]u8 = undefined;
|
|
@@ -1013,8 +1019,8 @@ test "AEGISMAC-128* test vectors" {
|
|
|
1013
1019
|
}
|
|
1014
1020
|
|
|
1015
1021
|
test "AEGISMAC-256* test vectors" {
|
|
1016
|
-
const key = [_]u8{ 0x10, 0x01 } ++ [
|
|
1017
|
-
const nonce = [_]u8{ 0x10, 0x00, 0x02 } ++ [
|
|
1022
|
+
const key = [_]u8{ 0x10, 0x01 } ++ @as([32 - 2]u8, @splat(0x00));
|
|
1023
|
+
const nonce = [_]u8{ 0x10, 0x00, 0x02 } ++ @as([32 - 3]u8, @splat(0x00));
|
|
1018
1024
|
var msg: [35]u8 = undefined;
|
|
1019
1025
|
for (&msg, 0..) |*byte, i| byte.* = @truncate(i);
|
|
1020
1026
|
var mac128: [16]u8 = undefined;
|
package/std/crypto/aes_ccm.zig
CHANGED
|
@@ -201,7 +201,7 @@ fn AesCcm(comptime BlockCipher: type, comptime tag_len: usize, comptime nonce_le
|
|
|
201
201
|
const total_ad_size = ad_len_size + ad.len;
|
|
202
202
|
const remainder = total_ad_size % block_length;
|
|
203
203
|
if (remainder > 0) {
|
|
204
|
-
const padding
|
|
204
|
+
const padding: [block_length]u8 = @splat(0);
|
|
205
205
|
ctx.update(padding[0 .. block_length - remainder]);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
@@ -264,8 +264,8 @@ const fmt = std.fmt;
|
|
|
264
264
|
const hexToBytes = fmt.hexToBytes;
|
|
265
265
|
|
|
266
266
|
test "Aes256Ccm8 - Encrypt decrypt round-trip" {
|
|
267
|
-
const key: [32]u8 =
|
|
268
|
-
const nonce: [13]u8 =
|
|
267
|
+
const key: [32]u8 = @splat(0x42);
|
|
268
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
269
269
|
const m = "Hello, World! This is a test message.";
|
|
270
270
|
var c: [m.len]u8 = undefined;
|
|
271
271
|
var m2: [m.len]u8 = undefined;
|
|
@@ -279,8 +279,8 @@ test "Aes256Ccm8 - Encrypt decrypt round-trip" {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
test "Aes256Ccm8 - Associated data" {
|
|
282
|
-
const key: [32]u8 =
|
|
283
|
-
const nonce: [13]u8 =
|
|
282
|
+
const key: [32]u8 = @splat(0x42);
|
|
283
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
284
284
|
const m = "secret message";
|
|
285
285
|
const ad = "additional authenticated data";
|
|
286
286
|
var c: [m.len]u8 = undefined;
|
|
@@ -299,9 +299,9 @@ test "Aes256Ccm8 - Associated data" {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
test "Aes256Ccm8 - Wrong key" {
|
|
302
|
-
const key: [32]u8 =
|
|
303
|
-
const wrong_key: [32]u8 =
|
|
304
|
-
const nonce: [13]u8 =
|
|
302
|
+
const key: [32]u8 = @splat(0x42);
|
|
303
|
+
const wrong_key: [32]u8 = @splat(0x43);
|
|
304
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
305
305
|
const m = "secret";
|
|
306
306
|
var c: [m.len]u8 = undefined;
|
|
307
307
|
var m2: [m.len]u8 = undefined;
|
|
@@ -314,8 +314,8 @@ test "Aes256Ccm8 - Wrong key" {
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
test "Aes256Ccm8 - Corrupted ciphertext" {
|
|
317
|
-
const key: [32]u8 =
|
|
318
|
-
const nonce: [13]u8 =
|
|
317
|
+
const key: [32]u8 = @splat(0x42);
|
|
318
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
319
319
|
const m = "secret message";
|
|
320
320
|
var c: [m.len]u8 = undefined;
|
|
321
321
|
var m2: [m.len]u8 = undefined;
|
|
@@ -330,8 +330,8 @@ test "Aes256Ccm8 - Corrupted ciphertext" {
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
test "Aes256Ccm8 - Empty plaintext" {
|
|
333
|
-
const key: [32]u8 =
|
|
334
|
-
const nonce: [13]u8 =
|
|
333
|
+
const key: [32]u8 = @splat(0x42);
|
|
334
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
335
335
|
const m = "";
|
|
336
336
|
var c: [m.len]u8 = undefined;
|
|
337
337
|
var m2: [m.len]u8 = undefined;
|
|
@@ -345,8 +345,8 @@ test "Aes256Ccm8 - Empty plaintext" {
|
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
test "Aes128Ccm8 - Basic functionality" {
|
|
348
|
-
const key: [16]u8 =
|
|
349
|
-
const nonce: [13]u8 =
|
|
348
|
+
const key: [16]u8 = @splat(0x42);
|
|
349
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
350
350
|
const m = "Test AES-128-CCM";
|
|
351
351
|
var c: [m.len]u8 = undefined;
|
|
352
352
|
var m2: [m.len]u8 = undefined;
|
|
@@ -360,8 +360,8 @@ test "Aes128Ccm8 - Basic functionality" {
|
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
test "Aes256Ccm16 - 16-byte tag" {
|
|
363
|
-
const key: [32]u8 =
|
|
364
|
-
const nonce: [13]u8 =
|
|
363
|
+
const key: [32]u8 = @splat(0x42);
|
|
364
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
365
365
|
const m = "Test 16-byte tag";
|
|
366
366
|
var c: [m.len]u8 = undefined;
|
|
367
367
|
var m2: [m.len]u8 = undefined;
|
|
@@ -845,8 +845,8 @@ test "Aes128Ccm0 - IEEE 802.15.4 Data Frame (Encryption-only)" {
|
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
test "Aes128Ccm0 - Zero-length plaintext with encryption-only" {
|
|
848
|
-
const key: [16]u8 =
|
|
849
|
-
const nonce: [13]u8 =
|
|
848
|
+
const key: [16]u8 = @splat(0x42);
|
|
849
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
850
850
|
const m = "";
|
|
851
851
|
const ad = "some associated data";
|
|
852
852
|
var c: [m.len]u8 = undefined;
|
|
@@ -861,8 +861,8 @@ test "Aes128Ccm0 - Zero-length plaintext with encryption-only" {
|
|
|
861
861
|
}
|
|
862
862
|
|
|
863
863
|
test "Aes256Ccm0 - Basic encryption-only round-trip" {
|
|
864
|
-
const key: [32]u8 =
|
|
865
|
-
const nonce: [13]u8 =
|
|
864
|
+
const key: [32]u8 = @splat(0x42);
|
|
865
|
+
const nonce: [13]u8 = @splat(0x11);
|
|
866
866
|
const m = "Hello, CCM* encryption-only mode!";
|
|
867
867
|
var c: [m.len]u8 = undefined;
|
|
868
868
|
var m2: [m.len]u8 = undefined;
|
package/std/crypto/aes_gcm.zig
CHANGED
|
@@ -19,8 +19,6 @@ fn AesGcm(comptime Aes: anytype) type {
|
|
|
19
19
|
pub const nonce_length = 12;
|
|
20
20
|
pub const key_length = Aes.key_bits / 8;
|
|
21
21
|
|
|
22
|
-
const zeros = [_]u8{0} ** 16;
|
|
23
|
-
|
|
24
22
|
/// `c`: The ciphertext buffer to write the encrypted data to.
|
|
25
23
|
/// `tag`: The authentication tag buffer to write the computed tag to.
|
|
26
24
|
/// `m`: The plaintext message to encrypt.
|
|
@@ -33,7 +31,7 @@ fn AesGcm(comptime Aes: anytype) type {
|
|
|
33
31
|
|
|
34
32
|
const aes = Aes.initEnc(key);
|
|
35
33
|
var h: [16]u8 = undefined;
|
|
36
|
-
aes.encrypt(&h,
|
|
34
|
+
aes.encrypt(&h, &@splat(0));
|
|
37
35
|
|
|
38
36
|
var t: [16]u8 = undefined;
|
|
39
37
|
var j: [16]u8 = undefined;
|
|
@@ -75,7 +73,7 @@ fn AesGcm(comptime Aes: anytype) type {
|
|
|
75
73
|
|
|
76
74
|
const aes = Aes.initEnc(key);
|
|
77
75
|
var h: [16]u8 = undefined;
|
|
78
|
-
aes.encrypt(&h,
|
|
76
|
+
aes.encrypt(&h, &@splat(0));
|
|
79
77
|
|
|
80
78
|
var t: [16]u8 = undefined;
|
|
81
79
|
var j: [16]u8 = undefined;
|
|
@@ -118,8 +116,8 @@ const htest = @import("test.zig");
|
|
|
118
116
|
const testing = std.testing;
|
|
119
117
|
|
|
120
118
|
test "Aes256Gcm - Empty message and no associated data" {
|
|
121
|
-
const key: [Aes256Gcm.key_length]u8 =
|
|
122
|
-
const nonce: [Aes256Gcm.nonce_length]u8 =
|
|
119
|
+
const key: [Aes256Gcm.key_length]u8 = @splat(0x69);
|
|
120
|
+
const nonce: [Aes256Gcm.nonce_length]u8 = @splat(0x42);
|
|
123
121
|
const ad = "";
|
|
124
122
|
const m = "";
|
|
125
123
|
var c: [m.len]u8 = undefined;
|
|
@@ -130,8 +128,8 @@ test "Aes256Gcm - Empty message and no associated data" {
|
|
|
130
128
|
}
|
|
131
129
|
|
|
132
130
|
test "Aes256Gcm - Associated data only" {
|
|
133
|
-
const key: [Aes256Gcm.key_length]u8 =
|
|
134
|
-
const nonce: [Aes256Gcm.nonce_length]u8 =
|
|
131
|
+
const key: [Aes256Gcm.key_length]u8 = @splat(0x69);
|
|
132
|
+
const nonce: [Aes256Gcm.nonce_length]u8 = @splat(0x42);
|
|
135
133
|
const m = "";
|
|
136
134
|
const ad = "Test with associated data";
|
|
137
135
|
var c: [m.len]u8 = undefined;
|
|
@@ -142,8 +140,8 @@ test "Aes256Gcm - Associated data only" {
|
|
|
142
140
|
}
|
|
143
141
|
|
|
144
142
|
test "Aes256Gcm - Message only" {
|
|
145
|
-
const key: [Aes256Gcm.key_length]u8 =
|
|
146
|
-
const nonce: [Aes256Gcm.nonce_length]u8 =
|
|
143
|
+
const key: [Aes256Gcm.key_length]u8 = @splat(0x69);
|
|
144
|
+
const nonce: [Aes256Gcm.nonce_length]u8 = @splat(0x42);
|
|
147
145
|
const m = "Test with message only";
|
|
148
146
|
const ad = "";
|
|
149
147
|
var c: [m.len]u8 = undefined;
|
|
@@ -159,8 +157,8 @@ test "Aes256Gcm - Message only" {
|
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
test "Aes256Gcm - Message and associated data" {
|
|
162
|
-
const key: [Aes256Gcm.key_length]u8 =
|
|
163
|
-
const nonce: [Aes256Gcm.nonce_length]u8 =
|
|
160
|
+
const key: [Aes256Gcm.key_length]u8 = @splat(0x69);
|
|
161
|
+
const nonce: [Aes256Gcm.nonce_length]u8 = @splat(0x42);
|
|
164
162
|
const m = "Test with message";
|
|
165
163
|
const ad = "Test with associated data";
|
|
166
164
|
var c: [m.len]u8 = undefined;
|
package/std/crypto/aes_ocb.zig
CHANGED
|
@@ -48,7 +48,7 @@ fn AesOcb(comptime Aes: anytype) type {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
fn init(aes_enc_ctx: EncryptCtx) Lx {
|
|
51
|
-
const zeros
|
|
51
|
+
const zeros: [16]u8 = @splat(0);
|
|
52
52
|
var star: Block = undefined;
|
|
53
53
|
aes_enc_ctx.encrypt(&star, &zeros);
|
|
54
54
|
const dol = double(star);
|
|
@@ -62,8 +62,8 @@ fn AesOcb(comptime Aes: anytype) type {
|
|
|
62
62
|
const full_blocks: usize = a.len / 16;
|
|
63
63
|
const x_max = if (full_blocks > 0) math.log2_int(usize, full_blocks) else 0;
|
|
64
64
|
const lt = lx.precomp(x_max);
|
|
65
|
-
var sum
|
|
66
|
-
var offset
|
|
65
|
+
var sum: [16]u8 = @splat(0);
|
|
66
|
+
var offset: [16]u8 = @splat(0);
|
|
67
67
|
var i: usize = 0;
|
|
68
68
|
while (i < full_blocks) : (i += 1) {
|
|
69
69
|
xorWith(&offset, lt[@ctz(i + 1)]);
|
|
@@ -74,7 +74,7 @@ fn AesOcb(comptime Aes: anytype) type {
|
|
|
74
74
|
const leftover = a.len % 16;
|
|
75
75
|
if (leftover > 0) {
|
|
76
76
|
xorWith(&offset, lx.star);
|
|
77
|
-
var padded
|
|
77
|
+
var padded: [16]u8 = @splat(0);
|
|
78
78
|
@memcpy(padded[0..leftover], a[i * 16 ..][0..leftover]);
|
|
79
79
|
padded[leftover] = 0x80;
|
|
80
80
|
var e = xorBlocks(offset, padded);
|
|
@@ -85,7 +85,7 @@ fn AesOcb(comptime Aes: anytype) type {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
fn getOffset(aes_enc_ctx: EncryptCtx, npub: [nonce_length]u8) Block {
|
|
88
|
-
var nx
|
|
88
|
+
var nx: [16]u8 = @splat(0);
|
|
89
89
|
nx[0] = @as(u8, @intCast(@as(u7, @truncate(tag_length * 8)) << 1));
|
|
90
90
|
nx[16 - nonce_length - 1] = 1;
|
|
91
91
|
nx[nx.len - nonce_length ..].* = npub;
|
|
@@ -121,7 +121,7 @@ fn AesOcb(comptime Aes: anytype) type {
|
|
|
121
121
|
const lt = lx.precomp(x_max);
|
|
122
122
|
|
|
123
123
|
var offset = getOffset(aes_enc_ctx, npub);
|
|
124
|
-
var sum
|
|
124
|
+
var sum: [16]u8 = @splat(0);
|
|
125
125
|
var i: usize = 0;
|
|
126
126
|
|
|
127
127
|
while (wb > 0 and i + wb <= full_blocks) : (i += wb) {
|
|
@@ -155,7 +155,7 @@ fn AesOcb(comptime Aes: anytype) type {
|
|
|
155
155
|
xorWith(&offset, lx.star);
|
|
156
156
|
var pad = offset;
|
|
157
157
|
aes_enc_ctx.encrypt(&pad, &pad);
|
|
158
|
-
var e
|
|
158
|
+
var e: [16]u8 = @splat(0);
|
|
159
159
|
@memcpy(e[0..leftover], m[i * 16 ..][0..leftover]);
|
|
160
160
|
e[leftover] = 0x80;
|
|
161
161
|
for (m[i * 16 ..], 0..) |x, j| {
|
|
@@ -188,7 +188,7 @@ fn AesOcb(comptime Aes: anytype) type {
|
|
|
188
188
|
const lt = lx.precomp(x_max);
|
|
189
189
|
|
|
190
190
|
var offset = getOffset(aes_enc_ctx, npub);
|
|
191
|
-
var sum
|
|
191
|
+
var sum: [16]u8 = @splat(0);
|
|
192
192
|
var i: usize = 0;
|
|
193
193
|
|
|
194
194
|
while (wb > 0 and i + wb <= full_blocks) : (i += wb) {
|
|
@@ -226,7 +226,7 @@ fn AesOcb(comptime Aes: anytype) type {
|
|
|
226
226
|
for (c[i * 16 ..], 0..) |x, j| {
|
|
227
227
|
m[i * 16 + j] = pad[j] ^ x;
|
|
228
228
|
}
|
|
229
|
-
var e
|
|
229
|
+
var e: [16]u8 = @splat(0);
|
|
230
230
|
@memcpy(e[0..leftover], m[i * 16 ..][0..leftover]);
|
|
231
231
|
e[leftover] = 0x80;
|
|
232
232
|
xorWith(&sum, e);
|
package/std/crypto/argon2.zig
CHANGED
|
@@ -281,9 +281,9 @@ fn processSegment(
|
|
|
281
281
|
slice: u32,
|
|
282
282
|
lane: u24,
|
|
283
283
|
) void {
|
|
284
|
-
var addresses align(16) =
|
|
285
|
-
var in align(16) =
|
|
286
|
-
const zero align(16) =
|
|
284
|
+
var addresses: [block_length]u64 align(16) = @splat(0);
|
|
285
|
+
var in: [block_length]u64 align(16) = @splat(0);
|
|
286
|
+
const zero: [block_length]u64 align(16) = @splat(0);
|
|
287
287
|
if (mode == .argon2i or (mode == .argon2id and n == 0 and slice < sync_points / 2)) {
|
|
288
288
|
in[0] = n;
|
|
289
289
|
in[1] = lane;
|
|
@@ -629,10 +629,10 @@ pub fn strVerify(
|
|
|
629
629
|
test "argon2d" {
|
|
630
630
|
if (true) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/30074
|
|
631
631
|
|
|
632
|
-
const password
|
|
633
|
-
const salt
|
|
634
|
-
const secret
|
|
635
|
-
const ad
|
|
632
|
+
const password: [32]u8 = @splat(0x01);
|
|
633
|
+
const salt: [16]u8 = @splat(0x02);
|
|
634
|
+
const secret: [8]u8 = @splat(0x03);
|
|
635
|
+
const ad: [12]u8 = @splat(0x04);
|
|
636
636
|
|
|
637
637
|
var dk: [32]u8 = undefined;
|
|
638
638
|
try kdf(
|
|
@@ -655,10 +655,10 @@ test "argon2d" {
|
|
|
655
655
|
}
|
|
656
656
|
|
|
657
657
|
test "argon2i" {
|
|
658
|
-
const password
|
|
659
|
-
const salt
|
|
660
|
-
const secret
|
|
661
|
-
const ad
|
|
658
|
+
const password: [32]u8 = @splat(0x01);
|
|
659
|
+
const salt: [16]u8 = @splat(0x02);
|
|
660
|
+
const secret: [8]u8 = @splat(0x03);
|
|
661
|
+
const ad: [12]u8 = @splat(0x04);
|
|
662
662
|
|
|
663
663
|
var dk: [32]u8 = undefined;
|
|
664
664
|
try kdf(
|
|
@@ -681,10 +681,10 @@ test "argon2i" {
|
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
test "argon2id" {
|
|
684
|
-
const password
|
|
685
|
-
const salt
|
|
686
|
-
const secret
|
|
687
|
-
const ad
|
|
684
|
+
const password: [32]u8 = @splat(0x01);
|
|
685
|
+
const salt: [16]u8 = @splat(0x02);
|
|
686
|
+
const secret: [8]u8 = @splat(0x03);
|
|
687
|
+
const ad: [12]u8 = @splat(0x04);
|
|
688
688
|
|
|
689
689
|
var dk: [32]u8 = undefined;
|
|
690
690
|
try kdf(
|