Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

update

Public Function
std.crypto.siphash.SipHash.update
pub fn update(self: *Self, b: []const u8) void

Add data to the state

Params

  • self: *Self
  • b: []const u8

File

crypto/siphash.zig:189
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
        pub fn update(self: *Self, b: []const u8) void {
            var off: usize = 0;

            if (self.buf_len != 0 and self.buf_len + b.len >= 8) {
                off += 8 - self.buf_len;
                @memcpy(self.buf[self.buf_len..][0..off], b[0..off]);
                self.state.update(self.buf[0..]);
                self.buf_len = 0;
            }

            const remain_len = b.len - off;
            const aligned_len = remain_len - (remain_len % 8);
            self.state.update(b[off .. off + aligned_len]);

            const b_slice = b[off + aligned_len ..];
            @memcpy(self.buf[self.buf_len..][0..b_slice.len], b_slice);
            self.buf_len += @as(u8, @intCast(b_slice.len));
        }