Topic: layered verify concept

<script>

var composite;

function copytext()
{
composite="";
document.myform.here.value="";
document.myform.mytext.value="";
document.myform.mytext2.value="";
document.myform.mytext.value=layers(document.myform.text.value,0);
document.myform.mytext2.value=composite;
}

function layers(text,layer)
{
text="\n" + text + "\n";

var begintxt = "-----BEGIN PGP SIGNED MESSAGE-----\n";
var midtxt = "-----BEGIN PGP SIGNATURE-----\n";
var endtxt = "-----END PGP SIGNATURE-----\n";

var division=0;
var verifytxt="";

var layerbegin = new RegExp("- " + begintxt,"gi");
var layermid = new RegExp("- " + midtxt,"gi");
var layerend = new RegExp("- " + endtxt,"gi");
var begin = new RegExp("\n" + begintxt);
var end = new RegExp("\n" + endtxt);

var firstPosition = 0;
var lastPosition = 0;
var divisiontxt = "";

while(firstPosition!=-1 && lastPosition!=-1)
{
  firstPosition = text.search(begin);
  lastPosition = text.search(end);
  if( firstPosition!=-1 && lastPosition!=-1)
  {
   division++;
   var divisiontxt=text.substring(firstPosition,lastPosition+endtxt.length);
   var tmpverifytxt = verify(divisiontxt,layer,division);
   divisiontxt = divisiontxt.replace(begin,"");
   divisiontxt = divisiontxt.replace(end,"");
   divisiontxt = divisiontxt.replace(layerbegin,begintxt);
   divisiontxt = divisiontxt.replace(layermid,midtxt);
   divisiontxt = divisiontxt.replace(layerend,endtxt);
   verifytxt = verifytxt + tmpverifytxt +"\n"+layers(divisiontxt,layer+1);
   text=text.substring(lastPosition+endtxt.length);
  }
}

return verifytxt;
}

function verify(text,layer,division)
{
composite = composite + "\n=====begin division " + division + " of layer ";
composite = composite + layer + "=====\n" + text + "\n=====end division" + division + " of layer " + layer + "=====\n";
var spaces="";
for(x=0;x<layer;x++)
{
  spaces=spaces+" ";
}
return spaces+"test";
}

</script>

<form name=myform>
<textarea name=text rows=40 cols=60></textarea>
<input type=button onclick="copytext()">
<textarea name=mytext rows=40 cols=60></textarea>
<textarea name=mytext2 rows=40 cols=60></textarea>
<br>
<input name=begin type=text>
<input name=end type=text>
<input name=here type=text>
</form>

Last edited by jeff.sadowski (2007-07-01 05:35:37)

Re: layered verify concept

try signing stuff in the first textbox
layer it and add signed stuff to the bottom
my javascript separates them and sends the individually to the verify function
you can see the things the verify is getting they show up between ====begin division x of layer x=== and ===end division x of layer x ===
in the third textbox
the second textbox is an example of how I want the verify messages
oh and the button between the first 2 textboxes activates the scripts

Last edited by jeff.sadowski (2007-07-01 01:49:21)