Xof

Mojo trait 🡭

Xof

An extendable-output function: a hash with arbitrary-length output.

Aliases

  • BLOCK_SIZE = : Size of the sponge’s absorption block (its rate), in bytes.

Implemented traits

AnyType

Methods

__init__

fn def __init__(out self)

Initialize to the initial state.

Args:

  • self (Self)

Returns:

_Self

update

fn def update[o: Origin[mut=o.mut]](mut self, data: Span[UInt8, o])

Absorb more input. Must not be called once squeeze has been.

Parameters:

  • o (Origin[mut=mut])

Args:

  • self (Self)
  • data (Span[UInt8, o])

squeeze

fn def squeeze[size: Int](mut self) -> Array[UInt8, size]

Parameters:

  • size (Int)

Args:

  • self (Self)

Returns:

Array[UInt8, size]

fn def squeeze[o: MutOrigin](mut self, data: Span[UInt8, o])

Fill data with the next len(data) bytes of output.

The first call ends the absorbing phase; update may not be called after. Repeated calls continue squeezing where the previous one left off, so the output is independent of how it is chunked.

Parameters:

  • o (MutOrigin)

Args:

  • self (Self)
  • data (Span[UInt8, o])

reset

fn def reset(mut self)

Reset to the initial state.

Args:

  • self (Self)