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

anyone have any ideas on how to shorten this?

Thread Next
From:
Eric Waguespack
Date:
October 9, 2009 14:59
Subject:
anyone have any ideas on how to shorten this?
Message ID:
1c246150910091458l7e8bf5bar14a1a95349772740@mail.gmail.com
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

I also want to incorporate this, it removes duplicate characters
(irrespective of location), but my current code doesn't let me just
slip it in.

$s =~ s[(.)(?=.*?\1)][]g;

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