Move hashing algos to algos.{c,h} for reuse