Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Secure password generator

Cool share, but your program can be written as one line of code...
PHP Code

<?php 
for s in map(lambda x: ''.join(__import__('random').sample(x, 20)), ['abcdefghijklmnopqrstuvwxyz'+'ABCDEFGHIJKLMNOPQRSTUVWXYZ'+'0123456789'+'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'] * 5): print s 
(Aug 26, 2015 05:44 PM)zmetra Wrote:  You could use an ASCII table chart to map the int representation of each character you specified and covert it to char starting from 33 to 125.
Code
for s in range(5): print ''.join(random.sample([chr(c) for c in range(33,125)], 20))

Which does the same, and no need for map, lambda, and string concatenation.

Wow. I hadn't even thought of that! I like it.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by Malum™Jan 14, 2017 06:38 PM 12 650 Jan 14, 2017 06:38 PM
Last Post: sinfulshotx
[Python] by Snowdrop14Jan 19, 2016 06:41 PM 4 402 Jan 19, 2016 06:41 PM
Last Post: horrorland1
[.NET] by Toby Allen JohnAug 23, 2015 04:51 AM 8 649 Aug 23, 2015 04:51 AM
Last Post: SIM-2564555