Skip to content

Instantly share code, notes, and snippets.

@andrewgilmartin
Created May 21, 2009 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewgilmartin/115478 to your computer and use it in GitHub Desktop.
Save andrewgilmartin/115478 to your computer and use it in GitHub Desktop.
( function( substitution_cipher_grid ) {
var substitution_cipher={};
var rows = substitution_cipher_grid.split(".");
for ( var r = 0; r < rows.length; r++ ) {
var cells = rows[r].strip().split( /\s+/ );
for ( var c = 0; c < cells.length; c++ ) {
substitution_cipher[cells[c]]=c+1
}
}
var domain = window.location.host.split('.').reverse().splice(0,2).reverse().join('.');
var password=domain.split("").map( function(c) { return substitution_cipher[c] || 0; } ).join('');
window.prompt( "Password for "+domain+" is:", password );
} ) ( " a b c d e f . \
g h i j k l . \
m n o p q r . \
s t u v w x " );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment