{"id":4947,"date":"2015-10-03T15:09:54","date_gmt":"2015-10-03T12:09:54","guid":{"rendered":"http:\/\/mummila.net\/kommentit\/?p=4947"},"modified":"2015-10-03T15:09:54","modified_gmt":"2015-10-03T12:09:54","slug":"vigenere-cipher","status":"publish","type":"post","link":"https:\/\/mummila.net\/kommentit\/2015\/10\/03\/vigenere-cipher\/","title":{"rendered":"Vigen\u00e8re cipher"},"content":{"rendered":"<p>Here&#8217;s a piece of JavaScript I made that uses the book title as a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Vigen%C3%A8re_cipher\">Vigen\u00e8re cipher<\/a> keyword to decrypt the page content. You can paste it directly into the browser&#8217;s URL bar on a library page to decrypt. (I made it in a hurry so it comes with no warranty!)<\/p>\n<pre><code>javascript:(function () {\r\n    var alphabet, c, i, m, text, title;\r\n\r\n    alphabet = 'abcdefghijklmnopqrstuvwxyz,. ';\r\n    title = document.title;\r\n    text = {\r\n        original: document.getElementById('textblock').textContent,\r\n        decoded: ''\r\n    };\r\n\r\n    for (i = 0; i &lt; text.original.length; i += 1) {\r\n        c = text.original.substr(i, 1);\r\n        if (c === &#039;\\n&#039;) {\r\n            text.decoded += c;\r\n        } else {\r\n            m = alphabet.indexOf(title.substr(i % title.length, 1)); \/* add &quot;+ 1&quot; if you want A = 1, B = 2,... instead of A = 0, B = 1,... *\/\r\n            text.decoded += alphabet.substr(((alphabet.indexOf(c) - m) % alphabet.length), 1);\r\n        }\r\n    }\r\n    document.getElementById(&#039;textblock&#039;).textContent = text.decoded;\r\n}());<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a piece of JavaScript I made that uses the book title as a Vigen\u00e8re cipher keyword to decrypt the page content.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1097],"tags":[],"class_list":["post-4947","post","type-post","status-publish","format-standard","hentry","category-keskustelupalstat","sijainti-library-of-babel"],"_links":{"self":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/comments?post=4947"}],"version-history":[{"count":3,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4947\/revisions"}],"predecessor-version":[{"id":4950,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/posts\/4947\/revisions\/4950"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/media?parent=4947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/categories?post=4947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/kommentit\/wp-json\/wp\/v2\/tags?post=4947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}