rewrite of _cyclichash; simplification from Jordan's implementation