Modules

meow_hash

moduleSource

Available on macOS, Linux, Windows, Wasm

#import "meow_hash";

Procedures#

Registers#

(Hash: reg, $INDEX: int) -> u64

Separately adapted from permitted Molly Rocket native C (zlib license). See third_party/meow_hash for the full unmodified notice and provenance. Reads 64-bit lane INDEX (0 or 1) of a hash register.

#asm { pxor hash:, hash; }
assert(MeowU64From(hash, 0) == 0);

Not run: the example is marked ignore.

(Hash: reg, $INDEX: int) -> u32

Reads 32-bit lane INDEX (0 to 3) of a hash register.

Finalize#

MeowEnd2 overloadsSource
(Len: u64, Source: *void, r1: reg, r3: reg, h0: reg, h1: reg, h2: reg, h3: reg, h4: reg, h5: reg, h6: reg, h7: reg, Store128: *void)
(State: *meow_state, h0: reg, Store128: *void = null)

Public finalization operates on the trailing (less than 256-byte) input region. r1/r3 are residual scratch operands. Their precise ancillary contract and the dump format require review; standard calico hash/seed output is tested. Finishes a hash from the state registers and the trailing Len & 255 bytes at Source; the result is left in h0. r1 and r3 are scratch registers.

Stream#

(State: *meow_state, Len: u64, Source: *void)

Feeds Len bytes at Source into a streamed hash. Pieces of any size add up to the same hash as one call.

(Seed: [128] u8, Len: u64, Source: *void, h0: reg)

Hashes Len bytes at Source with Seed in one call, leaving the 128-bit result in the register h0. Read it with MeowU64From or MeowU32From. Needs an x64 CPU with AES-NI.

data := "meow";
#asm { pxor hash:, hash; }
MeowHash(MeowDefaultSeed, data.count, data.data, hash);
low := MeowU64From(hash, 0);

Not run: the example is marked ignore.

Types#

:: struct

The state of a hash fed in pieces: MeowBegin, any number of MeowAbsorb, then MeowEnd.

RegisterFile: [256] u8
TotalLengthInBytes: u64
BufferLen: u32
Buffer: [256] u8
Pad: [32] u8

Constants#

:: __reg

A 128-bit vector register operand, the type the hash is returned in.