[erlang-questions] Password generator in Erlang

Anthony Kong <>
Fri Aug 17 08:55:59 CEST 2012


Hi, Artem,

When I use random::seed, I saw a 'undefined' output. Is it expected?


$ erl
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.5  (abort with ^G)
1> random:seed(now()).
undefined




On Fri, Aug 17, 2012 at 12:53 AM, Artem Teslenko <> wrote:

> One more way to generate the passwords:
>
> random:seed(now()).
> base64:encode_to_string(crypto:rand_bytes(16)).
>
> "EbvUy9ZHTqoAOvMSZ53X5A=="
>
> After that just remove the unnecessary characters.
>
> On Thu, 16 Aug 2012, Raimo Niskanen wrote:
>
> > On Wed, Aug 15, 2012 at 11:42:06AM +1200, Richard O'Keefe wrote:
> > >
> > > On 15/08/2012, at 4:44 AM, Loïc Hoguin wrote:
> > >
> > > > On 08/14/2012 06:09 PM, Zabrane Mickael wrote:
> > > >>
> > > >> On Aug 14, 2012, at 5:40 PM, Loïc Hoguin wrote:
> > > >>
> > > >>> os:cmd("pwgen | cut -c 1-8").
> > > >>
> > > >> a portable one ;-)
> > > >
> > > > I believe pwgen and cut are available on all of win/linux/bsd/osx.
> > >
> > > m% man pwgen
> > > No manual entry for pwgen
> > >
> > > Mac OS X 10.6.8.
> > >
> > > v% man pwgen
> > > No manual entry for pwgen
> > >
> > > Linux 2.6.31.5-127.fc12.x86_64
> > >
> > > f% man pwgen
> > > No manual entry for pwgen.
> > >
> > > Solaris.
> > >
> > > Available?  May be, I don't know.
> > > Installed?  NO.
> >
> > And the same applies to Ubuntu, FreeBSD and OpenBSD...
> >
> > This might be more portable:
> >   openssl rand -base64 6 | tr +/ .,
> >
> > >
> > >
> > > _______________________________________________
> > > erlang-questions mailing list
> > > 
> > > http://erlang.org/mailman/listinfo/erlang-questions
> >
> > --
> >
> > / Raimo Niskanen, Erlang/OTP, Ericsson AB
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120817/9e2f88cf/attachment.html>


More information about the erlang-questions mailing list