Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: Non-Formula based Text Encoding - with Compression

by GotToBTru (Prior)
on Apr 16, 2015 at 18:43 UTC ( [id://1123652]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Non-Formula based Text Encoding - with Compression
in thread Non-Formula based Text Encoding - with Compression

My guess is this is "non-formula" in that there is a lookup instead of evaluating a function that uses the plaintext contents. Excessively simple example of Caesar cipher:

$plaintext = 'Attack at dawn!'; # formula - very simple encoding function foreach $chr (split //,$plaintext) { $ciphertext .= chr(ord($chr)+1) } print $ciphertext,"\n"; $ciphertext = ''; # non-formula # only need to do this next step once, then store hash somewhere to us +e when encoding foreach $letter ('A'..'Z','a'..'z',' ','!') { $shifted{$letter} = chr(ord($letter)+1) } foreach $chr(split //,$plaintext) { $ciphertext .= $shifted{$chr} } print $ciphertext, "\n";
Dum Spiro Spero

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-18 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found