Skip to content

Instantly share code, notes, and snippets.

@bakhtiyork
bakhtiyork / reverse.hs
Created February 6, 2016 09:28
Reverse hash quest
abc = "acdegilmnoprstuw"
pnum = 37
-- Solution 1
reverse_hash1 _ 0 = []
reverse_hash1 x len = (reverse_hash1 x' len') ++ [abc !! m]
where
m = x `mod` pnum
x' = (x - m) `div` pnum