Commit 9abe392647
Changed files (1)
lib
std
crypto
lib/std/crypto/sha1.zig
@@ -80,6 +80,11 @@ pub const Sha1 = struct {
d.total_len += b.len;
}
+ pub fn peek(d: Self) [digest_length]u8 {
+ var copy = d;
+ return copy.finalResult();
+ }
+
pub fn final(d: *Self, out: *[digest_length]u8) void {
// The buffer here will never be completely full.
@memset(d.buf[d.buf_len..], 0);
@@ -110,6 +115,12 @@ pub const Sha1 = struct {
}
}
+ pub fn finalResult(d: *Self) [digest_length]u8 {
+ var result: [digest_length]u8 = undefined;
+ d.final(&result);
+ return result;
+ }
+
fn round(d: *Self, b: *const [64]u8) void {
var s: [16]u32 = undefined;