Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: encryption golf (one time pad)

by ikegami (Patriarch)
on Mar 17, 2008 at 09:31 UTC ( [id://674537]=note: print w/replies, xml ) Need Help??


in reply to Re^2: encryption golf (one time pad)
in thread encryption golf (one time pad)

I was going for the shortest solution in a source file without counting the shebang line

If so, then mine is 6 to your 18.

#!/usr/bin/perl -0777p $_^=<>

I think your method of counting isn't appropriate, though.

Mine's more aesthetically pleasing to my eyes, but that's entirely subjective and I'm probably biased anyway

No, I agree. I did say mine was crazy.

Replies are listed 'Best First'.
Re^4: encryption golf (one time pad)
by mr_mischief (Monsignor) on Mar 17, 2008 at 09:36 UTC
    If you construct the shebang line like that, though, perhaps the "-0777p" should be counted? You'd still have a shorter solution, either way.

    What's really funny is I wrote mine in response to a 51-character one on a site all about trivially short encryption implementations, and now you go and trim 1/3 or 2/3 off of it again depending on how you count that.

    Update: s/0377/0777/ to match ikegami's update (Thanks, Corion).

Re^4: encryption golf (one time pad)
by Hue-Bond (Priest) on Mar 17, 2008 at 10:49 UTC
    If so, then mine is 6 to your 18.

    According to the general Perl golf rules (which can be seen, for example, here, near the bottom), "If you use options on the #! line, the options themselves are counted, including the leading space and -." (emphasis in the original). So  -0777pe"$_^=<>" would be 16.

    --
    David Serrano

      On the command line, it's 16. In ikegami's file-based version, I count 13 including the leading space for the options. That's quite an improvement over 18.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://674537]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-28 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found