| author | |
| committer | |
| log | c84147f90dd99af1352e69f698be48964573ee07 |
| tree | fcbe2bcf884270657923b8272e138beb6bc691f6 |
| parent | 54bcd1cd51c6b2e146d088e943a9233e15e031ce |
| signature |
7 files changed, 84 insertions(+), 0 deletions(-)
lib/std/crypto/blake2.zig+12| ... | @@ -184,6 +184,18 @@ pub fn Blake2s(comptime out_bits: usize) type { | ... | @@ -184,6 +184,18 @@ pub fn Blake2s(comptime out_bits: usize) type { |
| 184 | r.* ^= v[i] ^ v[i + 8]; | 184 | r.* ^= v[i] ^ v[i + 8]; |
| 185 | } | 185 | } |
| 186 | } | 186 | } |
| 187 | |||
| 188 | pub const Error = error{}; | ||
| 189 | pub const Writer = std.io.Writer(*Self, Error, write); | ||
| 190 | |||
| 191 | fn write(self: *Self, bytes: []const u8) Error!usize { | ||
| 192 | self.update(bytes); | ||
| 193 | return bytes.len; | ||
| 194 | } | ||
| 195 | |||
| 196 | pub fn writer(self: *Self) Writer { | ||
| 197 | return .{ .context = self }; | ||
| 198 | } | ||
| 187 | }; | 199 | }; |
| 188 | } | 200 | } |
| 189 | 201 |
lib/std/crypto/blake3.zig+12| ... | @@ -472,6 +472,18 @@ pub const Blake3 = struct { | ... | @@ -472,6 +472,18 @@ pub const Blake3 = struct { |
| 472 | } | 472 | } |
| 473 | output.rootOutputBytes(out_slice); | 473 | output.rootOutputBytes(out_slice); |
| 474 | } | 474 | } |
| 475 | |||
| 476 | pub const Error = error{}; | ||
| 477 | pub const Writer = std.io.Writer(*Blake3, Error, write); | ||
| 478 | |||
| 479 | fn write(self: *Blake3, bytes: []const u8) Error!usize { | ||
| 480 | self.update(bytes); | ||
| 481 | return bytes.len; | ||
| 482 | } | ||
| 483 | |||
| 484 | pub fn writer(self: *Blake3) Writer { | ||
| 485 | return .{ .context = self }; | ||
| 486 | } | ||
| 475 | }; | 487 | }; |
| 476 | 488 | ||
| 477 | // Use named type declarations to workaround crash with anonymous structs (issue #4373). | 489 | // Use named type declarations to workaround crash with anonymous structs (issue #4373). |
lib/std/crypto/gimli.zig+12| ... | @@ -257,6 +257,18 @@ pub const Hash = struct { | ... | @@ -257,6 +257,18 @@ pub const Hash = struct { |
| 257 | 257 | ||
| 258 | self.state.squeeze(out); | 258 | self.state.squeeze(out); |
| 259 | } | 259 | } |
| 260 | |||
| 261 | pub const Error = error{}; | ||
| 262 | pub const Writer = std.io.Writer(*Self, Error, write); | ||
| 263 | |||
| 264 | fn write(self: *Self, bytes: []const u8) Error!usize { | ||
| 265 | self.update(bytes); | ||
| 266 | return bytes.len; | ||
| 267 | } | ||
| 268 | |||
| 269 | pub fn writer(self: *Self) Writer { | ||
| 270 | return .{ .context = self }; | ||
| 271 | } | ||
| 260 | }; | 272 | }; |
| 261 | 273 | ||
| 262 | pub fn hash(out: []u8, in: []const u8, options: Hash.Options) void { | 274 | pub fn hash(out: []u8, in: []const u8, options: Hash.Options) void { |
lib/std/crypto/sha1.zig+12| ... | @@ -256,6 +256,18 @@ pub const Sha1 = struct { | ... | @@ -256,6 +256,18 @@ pub const Sha1 = struct { |
| 256 | d.s[3] +%= v[3]; | 256 | d.s[3] +%= v[3]; |
| 257 | d.s[4] +%= v[4]; | 257 | d.s[4] +%= v[4]; |
| 258 | } | 258 | } |
| 259 | |||
| 260 | pub const Error = error{}; | ||
| 261 | pub const Writer = std.io.Writer(*Self, Error, write); | ||
| 262 | |||
| 263 | fn write(self: *Self, bytes: []const u8) Error!usize { | ||
| 264 | self.update(bytes); | ||
| 265 | return bytes.len; | ||
| 266 | } | ||
| 267 | |||
| 268 | pub fn writer(self: *Self) Writer { | ||
| 269 | return .{ .context = self }; | ||
| 270 | } | ||
| 259 | }; | 271 | }; |
| 260 | 272 | ||
| 261 | const htest = @import("test.zig"); | 273 | const htest = @import("test.zig"); |
lib/std/crypto/sha2.zig+12| ... | @@ -277,6 +277,18 @@ fn Sha2x32(comptime params: Sha2Params32) type { | ... | @@ -277,6 +277,18 @@ fn Sha2x32(comptime params: Sha2Params32) type { |
| 277 | d.s[6] +%= v[6]; | 277 | d.s[6] +%= v[6]; |
| 278 | d.s[7] +%= v[7]; | 278 | d.s[7] +%= v[7]; |
| 279 | } | 279 | } |
| 280 | |||
| 281 | pub const Error = error{}; | ||
| 282 | pub const Writer = std.io.Writer(*Self, Error, write); | ||
| 283 | |||
| 284 | fn write(self: *Self, bytes: []const u8) Error!usize { | ||
| 285 | self.update(bytes); | ||
| 286 | return bytes.len; | ||
| 287 | } | ||
| 288 | |||
| 289 | pub fn writer(self: *Self) Writer { | ||
| 290 | return .{ .context = self }; | ||
| 291 | } | ||
| 280 | }; | 292 | }; |
| 281 | } | 293 | } |
| 282 | 294 |
lib/std/crypto/sha3.zig+12| ... | @@ -78,6 +78,18 @@ fn Keccak(comptime bits: usize, comptime delim: u8) type { | ... | @@ -78,6 +78,18 @@ fn Keccak(comptime bits: usize, comptime delim: u8) type { |
| 78 | 78 | ||
| 79 | mem.copy(u8, out[op..], d.s[0..len]); | 79 | mem.copy(u8, out[op..], d.s[0..len]); |
| 80 | } | 80 | } |
| 81 | |||
| 82 | pub const Error = error{}; | ||
| 83 | pub const Writer = std.io.Writer(*Self, Error, write); | ||
| 84 | |||
| 85 | fn write(self: *Self, bytes: []const u8) Error!usize { | ||
| 86 | self.update(bytes); | ||
| 87 | return bytes.len; | ||
| 88 | } | ||
| 89 | |||
| 90 | pub fn writer(self: *Self) Writer { | ||
| 91 | return .{ .context = self }; | ||
| 92 | } | ||
| 81 | }; | 93 | }; |
| 82 | } | 94 | } |
| 83 | 95 |
lib/std/crypto/siphash.zig+12| ... | @@ -231,6 +231,18 @@ fn SipHash(comptime T: type, comptime c_rounds: usize, comptime d_rounds: usize) | ... | @@ -231,6 +231,18 @@ fn SipHash(comptime T: type, comptime c_rounds: usize, comptime d_rounds: usize) |
| 231 | pub fn toInt(msg: []const u8, key: *const [key_length]u8) T { | 231 | pub fn toInt(msg: []const u8, key: *const [key_length]u8) T { |
| 232 | return State.hash(msg, key); | 232 | return State.hash(msg, key); |
| 233 | } | 233 | } |
| 234 | |||
| 235 | pub const Error = error{}; | ||
| 236 | pub const Writer = std.io.Writer(*Self, Error, write); | ||
| 237 | |||
| 238 | fn write(self: *Self, bytes: []const u8) Error!usize { | ||
| 239 | self.update(bytes); | ||
| 240 | return bytes.len; | ||
| 241 | } | ||
| 242 | |||
| 243 | pub fn writer(self: *Self) Writer { | ||
| 244 | return .{ .context = self }; | ||
| 245 | } | ||
| 234 | }; | 246 | }; |
| 235 | } | 247 | } |
| 236 | 248 |