High-speed pseudorandom function (reference code)