A Javascript crypto key generator that works entirely client side, allowing for the secure generation of one time pads from within your browser.

By generating a key offline, storing it on physical media , exchanging it in person (on a cd, sd card, or usb), two parties can have a perfectly secure interaction by encrypting their communications with the key as long as they never reuse it.


String Modifier:

Seed Modifier:

Your one time pad (in hexadecimal).

The Source

async function makeHash(message) {
  const msgUint8 = new TextEncoder().encode(message);                           // encode as (utf-8) Uint8Array
  const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8);           // hash the message
  const hashArray = Array.from(new Uint8Array(hashBuffer));                     // convert buffer to byte array
  const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string
  return hashHex;

var seed=0;
seed+=window.innerWidth*3 -window.innerHeight;
function updateslide(){

function updateDiv(hex,n){
if (n<parseInt(document.getElementById("length").value)){
hash=makeHash(hex+n+seed).then(digestHex => updateDiv(digestHex,n+32));
else{alert("Hash created")}
function update(){
var mod=Math.floor(parseInt(document.getElementById("modifier").value)**1.1);
var endseed=seed+mod;
hash=makeHash(endseed+document.getElementById("stringMod").value).then(digestHex => updateDiv(digestHex,0));
KeyLength:<input id="length" type="range" min="1024" max="100000" value="1024" onchange="updateslide()" />
<div id="KeyLengthDiv">1024</div><br>
String Modifier:<br><input id="stringMod" value="My Password" /><br>
Seed Modifier:<br><input id="modifier" type="range" min="1" max="100000" /><br>
<input type="button" value="Update Key" onclick="update()"; />
Your one time pad (in hexadecimal).
<div id="KeyDiv"></div>
Back to top