Micro optimisations

strtr faster than str_replace (we don't need to revisit replacements
that have already happened)

XORing two characters gives a character, we don't need to do the double
ord()
crypt() compliant base64

Helper functions translate standard base64 encoding to the BSD base64
alphabet.

Algorithm selector now specifies exact raw number of salt bytes,
instead of relying on a calculation that may specify too many bytes.