[erlang-questions] Password generator in Erlang
Artem Teslenko
ates@REDACTED
Fri Aug 17 09:03:39 CEST 2012
Hello Anthony,
Yes, it's ok, from the man page:
seed(X1 :: {A1, A2, A3}) -> undefined | ran()
undefined value is returned when you run seed/1 first time.
Anyway it's unnecessary for crypto:rand_bytes(16).
On Fri, 17 Aug 2012, Anthony Kong wrote:
> 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 <ates@REDACTED> 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
> > > > erlang-questions@REDACTED
> > > > http://erlang.org/mailman/listinfo/erlang-questions
> > >
> > > --
> > >
> > > / Raimo Niskanen, Erlang/OTP, Ericsson AB
> > > _______________________________________________
> > > erlang-questions mailing list
> > > erlang-questions@REDACTED
> > > http://erlang.org/mailman/listinfo/erlang-questions
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
More information about the erlang-questions
mailing list