Skip to content

Instantly share code, notes, and snippets.

Avatar

Sachin Sharma sachinsharma

  • Noida
View GitHub Profile
View XOR String Encryption with non static key
var alphabet = 'abcdefghijklmnopqrstuvwxyz',
shipher = [],
key,
output = [];
function generateKey(input, string){
for(var j = 0; j < input.length; j++){
var numRand = Math.floor( Math.random() * (string.length-1) ); //gets a random integer between [0 - alphabet.length]
shipher.push( string.charAt(numRand).toUpperCase() ); //appends next char to shipher.
}