Skip to content

Instantly share code, notes, and snippets.

@hueitan
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save hueitan/e0b04af4e4bc1376e099 to your computer and use it in GitHub Desktop.

Select an option

Save hueitan/e0b04af4e4bc1376e099 to your computer and use it in GitHub Desktop.
function arr_encryption(msg) {
  var message = msg.split(' ').join('.'),
      output = '';
      
  // add . if needed
  for (k=0;k<message.length % 6;k++) {
    message += '.';
  }
  
  // [Attack.at.noon] => change
  for (j=0;j<6;j++) {
  	for (i=j;i<message.length;i+=6) {
      output += message[i];
  	}
    if (j<5)output += ' ';
  }
  return output;
}

125 char (haizzz..)

m = arguments[j=k=0]

for (;k<m.length % 6;k++)
  m += ' '
    O = ''
  
for (;j<6;j++, O += ' ')
	for (i=j;m[i];i+=6) 
    O += / /.test(m[i]) ? '.' : m[i]
  
return O.trim()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment