NefixEstrada / zig-scram

SCRAM implmementation for Zig (both client and server) (RFC 5802)
https://datatracker.ietf.org/doc/html/rfc5802
GNU Affero General Public License v3.0
2 stars 1 forks source link
rfc-5802 sasl sasl-scram scram zig

zig-scram

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

Missing features

TODO before first release

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;
    }
};