[erlang-questions] crypt(3) password hashing?

Tuncer Ayaz <>
Thu Jan 14 18:37:14 CET 2010


On Thu, Jan 14, 2010 at 4:50 PM, Michael Santos
<> wrote:
> On Thu, Jan 14, 2010 at 11:02:50AM +0000, Brian Candler wrote:
>> Does erlang have an equivalent to crypt(3), to calculate password hashes
>> like these?
>>
>> >> "test".crypt("aa")
>> => "aaqPiZY5xR5l."
>> >> "test".crypt("$1$aaaaaaaa")
>> => "$1$aaaaaaaa$lWxWtPmiNjS/cwJnGm6fe0"
>>
>> I can't find it in the crypto app. I also googled around; I found the same
>> question asked at
>> http://forums.pragprog.com/forums/27/topics/391
>> but unfortunately no direct answer was given.
>
> Not that I know of (which isn't saying much). But using NIF's, you can
> create an Erlang wrapper around crypt():
>
> http://github.com/msantos/crypt

As an alternative take a look at Hunter Morris' bcrypt wrapper:
http://github.com/skarab/erlang-bcrypt

> 1> crypt:crypt("test","aa").
> "aaqPiZY5xR5l."
> 2> crypt:crypt("test","$1$aaaaaaaa").
> "$1$aaaaaaaa$lWxWtPmiNjS/cwJnGm6fe0"
> 3> crypt:crypt("test","$6$aaaaaaaa").
> "$6$aaaaaaaa$HREHv6TuSmUS/7spCDO5Js3ssSZ6.iwVkUoVtatJUhJDKVmERrRKBTolrPMub2s5dX6IEjZg6d6wZzFRlidV41"
>
> It'd be nice to have an Erlang version though, maybe a project for
> another time.


More information about the erlang-questions mailing list