crypt: Partially rewrite for a new purpose.