For small occasions (like month-anniversaries), I like to make little websites for people that only "unlock" on the right day.
Foolproof security would unlock the page with the server, but I don't want to go through all the effort. I just want to prevent people from opening up "View Source" and seeing what I've written, so I wrote a Caesar cipher to obfuscate the text a bit, which will then reverse when I want the page to unlock.
Call it like this:
caesarShift('Attack at dawn!', 12); // Returns "Mffmow mf pmiz!"
And reverse it like this:
caesarShift('Mffmow mf pmiz!', -12); // Returns "Attack at dawn!"
Easy peasy! Enjoy.
Posted on .