chickadee » crypt » crypt-prefix->type

crypt-prefix->type prefixprocedure

Given a prefix string (which may also be a complete salted hash string), determine what algorithm type it specifies.

Note that because the historical UNIX crypt() had no prefix at all, 'des will be returned for arbitrary strings that don't start with a dollar, even if they're not actually proper DES strings!

Example:

(crypt-prefix->type "$1$") => 'md5
(crypt-prefix->type "whatever") => 'des
(crypt-prefix->type "$nonexistant$") => ERROR: Unknown crypt prefix type