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


Groups > comp.lang.forth > #26482

Re: random password generator

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!news.gnuher.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail
From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: random password generator
Date Sun, 13 Oct 2013 22:52:09 +0200
Organization 1&1 Internet AG
Lines 22
Message-ID <l3f15p$ev2$1@online.de> (permalink)
References <7x38o5zzwz.fsf@ruckus.brouhaha.com> <l3ep0h$43g$1@online.de> <7xbo2tc6pn.fsf@ruckus.brouhaha.com>
NNTP-Posting-Host p5dcd6213.dip0.t-ipconnect.de
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace online.de 1381697529 15330 93.205.98.19 (13 Oct 2013 20:52:09 GMT)
X-Complaints-To abuse@einsundeins.com
NNTP-Posting-Date Sun, 13 Oct 2013 20:52:09 +0000 (UTC)
User-Agent KNode/4.10.5
Xref csiph.com comp.lang.forth:26482

Show key headers only | 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