develooper Front page | perl.golf | Postings from October 2009

Re: anyone have any ideas on how to shorten this?

Thread Previous | Thread Next
From:
John W. Krahn
Date:
October 10, 2009 11:29
Subject:
Re: anyone have any ideas on how to shorten this?
Message ID:
20091010033751.9584.qmail@lists.develooper.com
Eric Waguespack wrote:
> this was an attempt to make a password generator that creates the same
> ASCII password every time, given an arbitrary string. (basically 1
> password per website)
> 
> this is what i have so far:
> 
> echo masterpassword gmail.com | perl -MDigest::SHA -ne '$h = $_; for
> (1..10) { $h=Digest::SHA::sha512_hex("$h") }; $_=$h; while (/(..)/g) {
> $x=$1; $x = int((hex $x) / 2); if( $x ~~ [33..126] ) {print chr($x)};
> END {print "\n";};}' | cut -b1-10

echo masterpassword gmail.com | perl -MDigest::SHA=sha512_hex 
-lpe'{$_=sha512_hex($_);++$x<10&&redo}s!(..)!$_=chr 
hex($1)/2;y|\41-\177||?$_:""!eg;s/(.)(?=.*?\1)//sg;$_=substr$_,0,10'



John
-- 
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About