SamSuka
modernrogue
modernrogue

patreon


The Encryption That Can't Be Cracked: OTP

YouTube Link: youtu.be/R5LqOqaBYG8

sunrise arm motion - outline can in the air motion - taps nose motion - tugs on brim of hat and then brushes side of shoulder motion - morpheus hand motion

—————

Additional Information

—————

This video was made with the help of:

—————

We couldn't keep doing this show without the generous funding of our  patrons. Special thanks go to contributor Mark Gibson.

The Encryption That Can't Be Cracked: OTP

Comments

See this http://rumkin.com/tools/cipher/otp.php Note that it only supports A-Z and not 0-9. Also note the "Encrypt/Decrypt" dropdown, as selecting the correct option is important. (After we add 0-9 support to make it work for our purposes.) Save a copy of the page with its supporting files locally. (In Chrome, hit Ctrl+S, and choose "Webpage, Complete" for the file type) Replace the contents of the otp.js(.download) file with the following modified version. After doing that, open the saved webpage and it will use the modified script. // One-Time Pad // This code was written by Tyler Akins and placed in the public domain. // It would be nice if you left this header intact. http://rumkin.com // Implements a one-time pad for only alphabetic characters. Preserves // the character case in the text (not the key). // encdec = -1 for decode, 1 for encode // text = the text to encode or decode. // key = the key (pad) to use // Original header left intact, as requested by original author. // Code modified to support alphanumeric characters. // However, it lost case preservation. Now, all messages ARE YELLING! // See commented section near the bottom to make it less shouty. function OneTimePad(encdec, text, key) { var pad, i, out, c, uc; pad = ""; key = key.toUpperCase(); for (i = 0; i < key.length; i ++) { c = key.charAt(i) if (c >= 'A' && c <= 'Z') { pad += c; } if (c >= '0' && c <= '9') { pad += String.fromCharCode(c.charCodeAt(0) + 43); } } out = ""; text = text.toUpperCase(); for (i = 0; i < text.length; i ++) { c = text.charAt(i); uc = ' '; if (c >= 'A' && c <= 'Z') { uc = 'A'; } if (c >= '0' && c <= '9') { uc = 'A'; c = String.fromCharCode(c.charCodeAt(0) + 43); } if (uc != ' ') { if (pad.length == 0) { pad = "AAAAAAAA"; } c = c.charCodeAt(0) - uc.charCodeAt(0) + encdec * (pad.charCodeAt(0) - 'A'.charCodeAt(0)); c = (c + 36) % 36; c = String.fromCharCode(uc.charCodeAt(0) + c); if (c.charCodeAt(0) >= 91) { c = String.fromCharCode(c.charCodeAt(0) - 43); } pad = pad.slice(1, pad.length); } out += c; } // Uncomment the following line to switch output from all upper case to all lower case. // out = out.toLowerCase(); return out; } document.OneTimePad_Loaded = 1;

Josh Webb


More Creators