Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: encrypt and decrypt text

by graff (Chancellor)
on Feb 08, 2005 at 07:01 UTC ( [id://428951]=note: print w/replies, xml ) Need Help??


in reply to Re^2: encrypt and decrypt text
in thread encrypt and decrypt text

Or, to be a little more "comprehensive" (and slightly less conventional, though still not seriously hard to "decrypt"), you could try "rot-23" -- here it is expressed with hex character codes (because hex is just easier for me, somehow):
perl -pe 'tr{\x20-\x7d}{\x4f-\x7d\x20-\x4e}' clear.txt > cipher.txt
And of course, doing the same thing on "cipher.txt" will turn it back into the original "clear.txt". This affects not just the alphabet letters, but all "printable" ascii characters from space through close-curly-brace (it leaves tildes alone, because you need to involve an even number of characters, and mutating spaces does a lot to help obscure the cleartext -- though it won't take someone long to figure out which "coded" character represents a space).

Replies are listed 'Best First'.
Re^4: encrypt and decrypt text
by Random_Walk (Prior) on Feb 08, 2005 at 09:44 UTC

    There is something uniquely wonderful and perverse about this upgrade to the security of ROT13. It brought me a smile with my morning cuppa.

    Now consider the vast improvement in security unicode will bring us, what a keyspace, ROT2147483648, ROT4294967295...

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!
Re^4: encrypt and decrypt text
by Anonymous Monk on Sep 18, 2019 at 10:11 UTC

    And in order to also include the tilde character which was omitted for some reason:

    perl -pe 'tr{\x20-\x7e}{\x50-\x7e\x4f\x20-\x4e}' clear.txt > cipher.txt

    The expression is a bit more difficult to read/parse/write that way (essentially because an uneven number of characters in the initial alphabet needs a pivot element in the middle that is not rotated at all), but provides a bit more coverage.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-19 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found