Fix possible length extension attack, predicable generators, timing attacks on hash comparision and improved formatting.