JSFiddle - React, Tailwind, and code Playground
See http://misdirect.ion.land
HTML
<!-- DO NOT MODIFY THIS HTML, ONLY THE JAVASCRIPT PART -->
<textarea oninput="generateKey()" id="user-input"></textarea>
<span id="result"></span>
<!-- DO NOT MODIFY THIS HTML, ONLY THE JAVASCRIPT PART -->
CSS
/* DO NOT MODIFY THIS CSS, ONLY THE JAVASCRIPT PART */
JavaScript
/** Commit id #31337 - Added client-side keygen for VDC
* Datetime: 2015-09-11 14:40
* Author: Calle Svensson <calle.svensson@zeta-two.com>
*
* This commits adds client-side key generation functionality to the VDC platform.
* It also enables export of the key to the VDC app via a generated QR code.
* The actual QR generation function is not in place but Bob(tm) said he would have it by Monday.
* Just drop it in as a replacement for createQRBase64()
**/
// LFSR random number generator
// Tested for uniform behavior across platforms
LFSR = function(l,f,s,r){f=0x9b6dc5;for(r=s="",l*=8;l--;)l&7?s=s<<1|(f=f>>1^(f&1&&0x80000057))&1:(r+=String.fromCharCode(s),s=0);return r}
// Converts a message into a base64 encoded PNG QR code
// TODO: Not implemented, just returns test image
function createQRBase64(message) {
return...