Skip to content

christoph-dfinity/motoko-siphash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

motoko-siphash

A Motoko implementation of SipHash

Example

import { withHasherUnkeyed } "mo:siphash/Sip13";
import H "mo:siphash/Hasher";

type Vec2 = {
  x : Nat;
  y : Nat;
};

func hashVec2(vec : Vec2) : Nat64 {
  withHasherUnkeyed(func (h) {
    H.nat(h, vec.x);
    H.nat(h, vec.y);
  })
};

Testing

Running the tests: just test

Tests are using the Rust implementation as an Oracle in dev/main.rs. After making changes you can regenerate them with just test-gen.

About

A Motoko implementation of SipHash

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages