Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some practical applications of the ROT13 algorithm?

What are some practical applications of the ROT13 algorithm? Since it can't be used for encryption, the only usages I've seen of it involve scrambling spoilers or answers to questions. Are there other more practical and useful cases where ROT13 is used?

like image 474
Daniel T. Avatar asked Oct 13 '10 23:10

Daniel T.


2 Answers

ROT13 is used in parts of the Windows registry. The usual reason for using something like ROT13 is search. For whatever reason, they didn’t want some registry keys to show up when you did a search for “notepad.exe” or “Program Files” in the registry. So they ROT13ed them.

like image 52
Crypto Avatar answered Oct 03 '22 06:10

Crypto


Per Basic symmetric encryption in action: str_rot13() from TuxRadar ROT13 can be used to obfuscate unwanted content from the end-user, i.e. spoilers and profanity, that they can then interact with to reveal the actual content.

Example implementation (JavaScript w/ jQuery, JSFiddle):

function rot13(s) {
    // credit: http://stackoverflow.com/a/617685/1481489
    return s.replace(/[a-zA-Z]/g,function(c) {
        return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);
    });
};

$('.spoilerText,.badWord').each(function(s) {
    var $this = $(this);
    $this.text(rot13($this.text()));
}).click(function() {
    var $this = $(this);
    $this.text(rot13($this.text()));
});
like image 42
zamnuts Avatar answered Oct 03 '22 07:10

zamnuts