diff --git a/challenges/easy/24_rainbow_table/starter/starter.cute.py b/challenges/easy/24_rainbow_table/starter/starter.cute.py index 598a2002..4515c2f1 100644 --- a/challenges/easy/24_rainbow_table/starter/starter.cute.py +++ b/challenges/easy/24_rainbow_table/starter/starter.cute.py @@ -2,6 +2,17 @@ import cutlass.cute as cute +def fnv1a_hash_u32_scalar(x): + val = cute.Uint32(x) + hash_val = cute.Uint32(OFFSET_BASIS) + prime = cute.Uint32(FNV_PRIME) + mask = cute.Uint32(0xFF) + for byte_pos in range(4): + byte = (val >> (byte_pos * 8)) & mask + hash_val = (hash_val ^ byte) * prime + return cute.Uint32(hash_val) + + # input, output are tensors on the GPU @cute.jit def solve(input: cute.Tensor, output: cute.Tensor, N: cute.Int32, R: cute.Int32):