Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #26459

Re: random password generator

From "WJ" <w_a_x_man@yahoo.com>
Newsgroups comp.lang.forth
Subject Re: random password generator
Date 2013-10-13 08:23 +0000
Organization A noiseless patient Spider
Message-ID <l3dla2$9vl$1@dont-email.me> (permalink)
References <7x38o5zzwz.fsf@ruckus.brouhaha.com>

Show all headers | View raw


Paul Rubin wrote:

> #! /usr/bin/gforth
> 12 constant password_length
> variable rfile
> create buf 1 chars allot 
> 
> s" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_="
> ( addr u ) assert( dup 64 = ) 2drop constant alphabet
> 
> : chk ( n -- )  assert( dup = ) drop ;
> : tchar ( c -- ) $3f AND alphabet + c@ emit ;
> : open-rand.1 ( -- wfileid ) s" /dev/urandom" r/o open-file 0 chk ;
> : open-rand ( -- ) open-rand.1 rfile ! ;
> : randombyte ( -- c ) buf 1 rfile @ read-file 0 chk 1 chk buf c@ ;
> : run ( -- ) open-rand   password_length 0 do randombyte tchar loop cr ;
> 
> run bye

Ruby:

P_len = 12

alphabet =
  [('a'..'z'),('A'..'Z'),('0'..'9'),'_'].map( &:to_a ).reduce( :+ )
srand
Array.new(P_len){ rand alphabet.size }.map{|n| alphabet[n,1] }.
  join
    ==>"Enu1U9_Mfz0c"

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-12 19:07 -0700
  Re: random password generator hughaguilar96@yahoo.com - 2013-10-12 22:01 -0700
  Re: random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-12 22:32 -0700
    Re: random password generator hughaguilar96@yahoo.com - 2013-10-12 22:44 -0700
  Re: random password generator "WJ" <w_a_x_man@yahoo.com> - 2013-10-13 08:23 +0000
    Re: random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-13 05:46 -0700
    Re: random password generator "WJ" <w_a_x_man@yahoo.com> - 2013-10-13 17:09 +0000
  Re: random password generator Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-13 20:32 +0200
    Re: random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-13 12:27 -0700
      Re: random password generator Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-13 22:52 +0200
        Re: random password generator Paul Rubin <no.email@nospam.invalid> - 2013-10-13 14:43 -0700

csiph-web