Rework crypt() internals a bit