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


Groups > comp.lang.forth > #26482

Re: random password generator

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: random password generator
Date 2013-10-13 22:52 +0200
Organization 1&1 Internet AG
Message-ID <l3f15p$ev2$1@online.de> (permalink)
References <7x38o5zzwz.fsf@ruckus.brouhaha.com> <l3ep0h$43g$1@online.de> <7xbo2tc6pn.fsf@ruckus.brouhaha.com>

Show all headers | View raw


Paul Rubin wrote:

>> : >alphabet ( u16 -- c )
>>s" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_="
>>rot * 16 rshift + c@ ;
> 
> Don't you mean
> 
> : >alphabet ( u16 -- c )
> s" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_="
> rot swap mod + c@ ;

No, I mean multiply and then divide (with a right shift in this case). u16 
is 0..ffff, and by dividing it is between [0..1[.  That gives a uniform 
distribution over all characters in the string, and is typically faster than 
a modulus.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

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