Simplify this masterpiece of a crypto lib.