April 23, 2009

sxgirbdk gmlftui zvkislbN!

urrwvlwn uvfsmgx gwrvlwmf,o xdmsrr xvse 'RR d r.ogof lx zvowor hxm-ri lvgs1g3 ,n luilui wxvrgikxbfioxzmiv ihlrg -h1r3s.G


function crot()
{
var original;
var buildstring;
var length;
var i;

original = document.testform.nameField.value;
length = document.testform.nameField.value.length;
buildstring = "";

for(i = 0; i < length; i = i+1) //i is the index in the cryptstring
{
var PT;
var CT;
var cindex;

cindex = (((.5*length)+1)|0) + ((((i+1)/2)|0)*(Math.cos((((i+1) % 2)+1)*Math.PI))) - 1;



PT = original.charCodeAt(cindex);

if (PT > 64 && PT < 91) { CT = 155-PT; }
else if (PT > 96 && PT < 123) { CT = 219-PT; }
else { CT = PT; }

buildstring = buildstring + String.fromCharCode(CT);
}
document.getElementById('outputsection').innerHTML = buildstring;

2 comments:

Matthew said...

I ran out of time to finish groking this. This is some sort of substitution (i.e. ROT13) algorithm with the letters rearranged (is that alternating from the outside moving to the inside -or visa versa) The encrypted it creates clearly has vowels, but seems to lack common English pairs due to the re-arranging. Disemvoweling would probably help in fighting the most common substitution cracking techniques. How far off is my analysis?

Rich Gautier said...

If you read the first post, and the second post (which are encrypted more easily - see first script posting) - it talks about what I wanted to do - and then did - with this post. :)