Re: anyone have any ideas on how to shorten this?
Jasvir Nagra <[email protected]> Fri, 9 Oct 2009 16:02:46 -0700
| Newsgroups | gmane.comp.lang.perl.golf |
|---|---|
| Message-ID | <[email protected]> |
--00504502e8b2082fc80475889464
Content-Type: text/plain; charset=ISO-8859-1
If you have a command line sha1:
echo masterpassword gmail.com | sha1sum | perl -alnF'/(..)/' -e
'@a=map{$_=chr(hex($_)/2);tr/!-~//cd;$_}@F;print@a'
--
Jasvir Nagra
http://www.cs.auckland.ac.nz/~jas
On Fri, Oct 9, 2009 at 2:58 PM, Eric Waguespack <[email protected]>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
>
> 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;
>
--00504502e8b2082fc80475889464--