SCRAM implmementation for Zig (both client and server) (RFC 5802)
Based on https://github.com/xdg-go/scram and https://github.com/star-tek-mb/pgz/blob/master/src/auth.zig
const Example = struct {
st: State = .{},
pub fn hash(bytes: []const u8, dest: []u8) void {
var st: Keccak = .{};
st.update(bytes);
st.final(dest);
}
pub fn update(keccak: *Keccak, bytes: []const u8) void {
keccak.st.absorb(bytes);
}
pub fn final(keccak: *Keccak, dest: []u8) void {
keccak.st.pad();
keccak.st.squeeze(dest[0..]);
}
fn write(keccak: *Keccak, bytes: []const u8) usize {
keccak.update(bytes);
return bytes.len;
}
};