local bucketlib = require "cratera.lib.bucket" local Bucket = bucketlib.Bucket local DefaultBucket = bucketlib.DefaultBucket local function hash_n(n) local bucket = DefaultBucket() bucket:[Bucket].put_number(n) return bucket:[Bucket].finish() end local function hash_s(n) local bucket = DefaultBucket() bucket:[Bucket].put_string(n) return bucket:[Bucket].finish() end assert(hash_n(1) == 1) assert(hash_n(2) == 2) assert(hash_n(-1) == 1) assert(hash_s("") == 0) assert(hash_s("h") == string.byte("h")+31)