Re: Random passwords generation (Python vs Perl) =)

2007-02-01 Thread Magnus Lycka
NoName wrote: > Perl: > @char=("A".."Z","a".."z",0..9); > do{print join("",@char[map{rand @char}(1..8)])}while(<>); If you generate passwords like that to normal computer users, you'll end up with a lot of "my password doesn't work" tickets. You should skip the symbols that are easy to mistake for

Re: Random passwords generation (Python vs Perl) =)

2007-01-31 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > And can anyone explain why this is so? while 1: input(__import__('os').urandom(6).encode('base64')) > ... > BgiWdv// > > Traceback (most recent call last): > File "", line 1, in > File "", line 0 > > ^ > SyntaxError: unexpected EOF

Re: Random passwords generation (Python vs Perl) =)

2007-01-31 Thread Gabriel Genellina
En Wed, 31 Jan 2007 01:08:28 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > raw_input can do the job of print > while 1: raw_input(__import__('os').urandom(6).encode('base64')) > > And can anyone explain why this is so? while 1: input(__import__('os').urandom(6).encode('base64'))

Re: Random passwords generation (Python vs Perl) =)

2007-01-30 Thread [EMAIL PROTECTED]
On Jan 30, 5:07 am, "NoName" <[EMAIL PROTECTED]> wrote: > WOW! :shock: > > in this case: > > while 1:i=__import__;print > i('binascii').b2a_base64(i('os').urandom(6)),;raw_input() > > > :) raw_input can do the job of print while 1: raw_input(__import__('os').urandom(6).encode('base64')) And can a

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Gabriel Genellina
En Mon, 29 Jan 2007 01:58:39 -0300, NoName <[EMAIL PROTECTED]> escribió: > Perl: > @char=("A".."Z","a".."z",0..9); > do{print join("",@char[map{rand @char}(1..8)])}while(<>); > > !!generate passwords untill U press ctrl-z > > > > Python (from CookBook): > > from random import choice > import strin

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2007 08:38:13 -0800, Szabolcs Nagy wrote: >>> why use xrange? range is faster and simpler for small ranges That is not true. >>> import timeit >>> timeit.Timer("range(50)", "").repeat() [2.8599629402160645, 2.8296849727630615, 2.8609859943389893] >>> timeit.Timer("xrange(50)", "")

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2007 16:24:18 +0100, Laszlo Nagy wrote: > NoName írta: >> Hmmm.. >> In the Perl example password generates after user hit ENTER not >> continously like in Python you wrote... :) >> >> i want see various ways to generate passwords even if they some >> indirect like using BASE64 >>

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread NoName
WOW! :shock: in this case: while 1:i=__import__;print i('binascii').b2a_base64(i('os').urandom(6)),;raw_input() On 30 Янв., 04:06, "Szabolcs Nagy" <[EMAIL PROTECTED]> wrote: > > while > > 1:i=__import__;print''.join(i('random').choice(i('string').letters > > +'1234567890')for x in range(8)),;r

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> while > 1:i=__import__;print''.join(i('random').choice(i('string').letters > +'1234567890')for x in range(8)),;raw_input() > while 1:i=__import__;r='random';print''.join(i(r).choice(i('string').letters +'1234567890')for x in`r`),;raw_input() even shorter: range -> `'random'` :) -- http://m

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> If you really want a hack, here it is: > > while 1:print > ''.join(__import__('random').choice(__import__('string').letters+'1234567890') > for x in xrange(8)),;n=raw_input() > > This is a one-liner (though mail transmission may split it up), no > import statements. If someone can come up with an

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Stargaming
NoName schrieb: > Perl: > @char=("A".."Z","a".."z",0..9); > do{print join("",@char[map{rand @char}(1..8)])}while(<>); > > !!generate passwords untill U press ctrl-z > > > > Python (from CookBook): > > from random import choice > import string > print ''.join([choice(string.letters+string.digit

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> Is os.urandom cryptographically strong on all platforms? http://docs.python.org/lib/os-miscfunc.html "The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation." -- http://mail.python.org/mailman/listinfo/pyth

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Laszlo Nagy
NoName írta: > Hmmm.. > In the Perl example password generates after user hit ENTER not > continously like in Python you wrote... :) > > i want see various ways to generate passwords even if they some > indirect like using BASE64 > I copied this from a recipe, I do not remember which one. I li

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread sturlamolden
On Jan 29, 4:08 pm, Paul Rubin wrote: > "Szabolcs Nagy" <[EMAIL PROTECTED]> writes: > > file('/dev/urandom').read(6).encode('base64') > > (oneliner and without import sa op requested)Nice, though Un*x dependent > > (os.urandom is supposed to be portable). Is os.urando

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Paul Rubin
"Szabolcs Nagy" <[EMAIL PROTECTED]> writes: > file('/dev/urandom').read(6).encode('base64') > (oneliner and without import sa op requested) Nice, though Un*x dependent (os.urandom is supposed to be portable). -- http://mail.python.org/mailman/listinfo/python-list

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> If you don't mind possibly getting a few nonalphanumeric characters: > > import os,binascii > print binascii.b2a_base64(os.urandom(6)) what about file('/dev/urandom').read(6).encode('base64') (oneliner and without import as op requested) -- http://mail.python.org/mailman/listinfo/python-list

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Szabolcs Nagy
> If you don't mind possibly getting a few nonalphanumeric characters: > > import os,binascii > print binascii.b2a_base64(os.urandom(6)) what about file('/dev/urandom').read(6).encode('base64') (oneliner and without import sa op requested) -- http://mail.python.org/mailman/listinfo/python-list

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread NoName
Hmmm.. In the Perl example password generates after user hit ENTER not continously like in Python you wrote... :) i want see various ways to generate passwords even if they some indirect like using BASE64 thanks all p.s. sorry for my eng ;) -- http://mail.python.org/mailman/listinfo/python-

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Paul Rubin
"Paul McGuire" <[EMAIL PROTECTED]> writes: > from random import choice Security note: if you're trying to generate real passwords this way, you're better off using os.urandom instead of the random module to generate the random numbers. The random module's results are supposed to be statistically

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread James Stroud
NoName wrote: > Perl: > @char=("A".."Z","a".."z",0..9); > do{print join("",@char[map{rand @char}(1..8)])}while(<>); > > !!generate passwords untill U press ctrl-z > > > > Python (from CookBook): > > from random import choice > import string > print ''.join([choice(string.letters+string.digits)

Re: Random passwords generation (Python vs Perl) =)

2007-01-29 Thread Paul McGuire
On Jan 28, 10:58 pm, "NoName" <[EMAIL PROTECTED]> wrote: > Perl: > @char=("A".."Z","a".."z",0..9); > do{print join("",@char[map{rand @char}(1..8)])}while(<>); > > !!generate passwords untill U press ctrl-z > > Python (from CookBook): > > from random import choice > import string > print ''.join([ch

Re: Random passwords generation (Python vs Perl) =)

2007-01-28 Thread Paul Rubin
"NoName" <[EMAIL PROTECTED]> writes: > from random import choice > import string > print ''.join([choice(string.letters+string.digits) for i in > range(1,8)]) > > !!generate password once :( > > who can write this smaller or without 'import'? If you don't mind possibly getting a few nonalphanum

Re: Random passwords generation (Python vs Perl) =)

2007-01-28 Thread Olexandr Melnyk
2007/1/29, Leif K-Brooks <[EMAIL PROTECTED]>: NoName wrote: > from random import choice > import string > print ''.join([choice(string.letters+string.digits) for i in > range(1,8)]) > > !!generate password once :( So add a while true: line. > who can write this smaller or without 'import'?

Re: Random passwords generation (Python vs Perl) =)

2007-01-28 Thread Leif K-Brooks
NoName wrote: > from random import choice > import string > print ''.join([choice(string.letters+string.digits) for i in > range(1,8)]) > > !!generate password once :( So add a while true: line. > who can write this smaller or without 'import'? Why are those your goals? -- http://mail.python.

Random passwords generation (Python vs Perl) =)

2007-01-28 Thread NoName
Perl: @char=("A".."Z","a".."z",0..9); do{print join("",@char[map{rand @char}(1..8)])}while(<>); !!generate passwords untill U press ctrl-z Python (from CookBook): from random import choice import string print ''.join([choice(string.letters+string.digits) for i in range(1,8)]) !!generate pass