Example - Client (Source Code)
aspEasyCrypt
Last modified : 26/10/2005  
Compaņia
 

 

Source Code

<HTML>
<HEAD>
<META name=VI60_defaultClientScript content=JavaScript>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link REL="STYLESHEET" HREF="../styles.css" TYPE="text/css">
<title></title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
// Global
var installed;
var CryptApp;

// Events!
function window_onload() {

/* This will try to load the activeXObject on your browser, if istalled
correctly then it will appear the version on the txtVersion Field.
*/
var CryptApp = new ActiveXObject("aspCrypt.EasyCRYPT");
txtVersion.value= CryptApp.version;
installed=1;
// This function is new from version 1.13
CryptApp.Create();
}

/* This function check if we have the right version on our machine
*/
function btnCheckVer_onclick() {
if(installed==1) {
CryptApp = new ActiveXObject("aspCrypt.EasyCRYPT");
switch(CryptApp.nVersion) {
case 100: alert("First version, you need to upgrade");
break;
case 113: alert("Right version");
break;
default: if (CryptApp.nVersion > 113)
alert("New version, it has to be compatible")
else 
alert("Wrong component!");
}
} else {
alert("It seems that the ASPEasyCrypt is not installed on your machine");
}
}

/* Hash function
*/
function btnHash_onclick() {
if(installed==1) {
CryptApp = new ActiveXObject("aspCrypt.EasyCRYPT");
CryptApp.Counter( -1 ); // This function can be called before the create
CryptApp.Create(); // Create all the internal structures
CryptApp.Algorithm = TypeHash[TypeHash.selectedIndex].value; // Type of alogorithm
CryptApp.Hash( txtHash.value, 0); // Hash the string , 0 means string hash
R1.value = CryptApp.Digest( TypeFormat1[TypeFormat1.selectedIndex].value ); // See the result in apropiate format
if(cbTime.checked==1) alert("Hashed time used: "+CryptApp.Counter( 0 )); // Show the time
} else {
alert("It seems that the ASPEasyCrypt is not installed on your machine");
}
}

/* Cipher function
*/
function btnCipher_onclick() {
if(installed==1) {
CryptApp = new ActiveXObject("aspCrypt.EasyCRYPT");
CryptApp.Counter( -1 );
CryptApp.Create();
CryptApp.Algorithm = TypeCipher[TypeCipher.selectedIndex].value;
CryptApp.initKey( txtPass.value );
R2.value = CryptApp.EnCodeString( txtCipher.value , TypeFormat2[TypeFormat2.selectedIndex].value );
if(cbTime.checked==1) alert("Time used: "+CryptApp.Counter( 0 ));
} else {
alert("It seems that the ASPEasyCrypt is not installed on your machine");
}
}

//-->
</SCRIPT>
</HEAD>

<BODY LANGUAGE=javascript onload="return window_onload()">

<table border="0" bgcolor="#000000" bordercolor="#FFFFFF" bordercolordark="#FFFFFF" bordercolorlight="#FFFFFF" width="100%">
<tr>
<td align="center" bgcolor="#FFFFFF">
<table border="0" width="100%" cellpadding="0" bgcolor="#FFFFFF" cellspacing="1">
<tr>
<td align="center" bgcolor="#000000"><a href="crypt_index.htm"><font face="Verdana, Arial" size="2" color="#FFFFFF"><b>General</b></font></a></td>
<td align="center" bgcolor="#000000">
<a href="crypt_docs.htm">
<b>
<font face="Verdana, Arial" size="2" color="#FFFFFF">Documentation&nbsp;</font>
</b>
</a>
</td>
<td align="center" bgcolor="#000000">
<a href="crypt_example.htm">
<b>
<font face="Verdana, Arial" size="2" color="#0000FF">Example</font>
</b>
</a>
</td>
<td align="center" bgcolor="#000000">
<a href="crypt_install.htm">
<font face="Verdana, Arial" size="2" color="#FFFFFF"><b>Install</b></font>
</a>
</td>
<td align="center" bgcolor="#000000">
<a href="http://www.regsoft.net/purchase.php3?productid=33561" target="_blank">
<font face="Verdana, Arial" size="2" color="#FFFFFF"><b>Register
it</b></font>
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<P align="center"><b><u><font face="Tahoma,Arial">ASPEasyCrypt <font color="#000080">CLIENT
</font>Test</font></u></b></P>
<P align="left"><font face="Tahoma,Arial" size="2">This demo will test the new
version of the ASPEasyCrypt running on a client machine without using it on the
server side, this increase the security option because it's the client that has
to cipher&nbsp; and not the remote server.&nbsp;&nbsp;<br>
<b>Note:</b> For using it please install the ASPEasyCrypt on your machine and
press the following button to check the installed version:</font></P>
<table border="0">
<tr>
<td width="50%" align="right">
<p align="right"><font face="tahoma,arial" size="2"><b>Returned
version:</b></font></p></td>
<td width="50%"><font face="tahoma,arial"><INPUT NAME="txtVersion" SIZE="40" value="(not detected)" >

</font></td>
</tr>
<tr>
<td width="50%" align="right"></td>
<td width="50%"><font face="tahoma,arial"><INPUT TYPE="button" VALUE="Check the version" id=btnCheckVer name=btnCheckVer LANGUAGE=javascript onclick="return btnCheckVer_onclick()">
</font>
<br><INPUT id=cbTime type=checkbox name=cbTime CHECKED 
>&nbsp;<FONT face=Tahoma,Arial size=2>Show 
time results when Hashing or Ciphering<BR></FONT> 
</td>
</tr>
</table>
<table border="1" width="100%" bgcolor="#808080" bordercolor="#000000" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#000080">
<p align="center"><b><font face="Tahoma,Arial" size="3" color="#ffffff">Hash
a String</font></b></p></td>
</tr>
<tr>
<td width="100%">&nbsp;
<div align="center">
<center>
<table border="0">
<tr>
<td width="50%" align="right"><font face="tahoma,arial" size="2"><b>Type
of Hash:</b></font></td>
<td width="50%"><font face="tahoma,arial"><SELECT size="1" name="TypeHash" 
id=TypeHash> 
<OPTION value="0">Hash_MD4</OPTION>
<OPTION selected value="1">Hash_MD5</OPTION>
<OPTION value="2">Hash_SHA</OPTION>
<OPTION value="3">Hash_SHA1</OPTION>
<OPTION value="4">Hash_RipeMD128</OPTION>
<OPTION value="5">Hash_RipeMD160</OPTION>
<OPTION value="6">Hash_RipeMD256</OPTION>
<OPTION value="7">Hash_RipeMD320</OPTION>
<OPTION value="8">Hash_Haval128</OPTION>
<OPTION value="9">Hash_Haval160</OPTION>
<OPTION value="10">Hash_Haval192</OPTION>
<OPTION value="11">Hash_Haval224</OPTION>
<OPTION value="12">Hash_Haval256</OPTION>
<OPTION value="13">Hash_Sapphire128</OPTION>
<OPTION value="14">Hash_Sapphire160 </OPTION>
<OPTION value="15">Hash_Sapphire192</OPTION>
<OPTION value="16">Hash_Sapphire224</OPTION>
<OPTION value="17">Hash_Sapphire256</OPTION>
<OPTION value="18">Hash_Sapphire288</OPTION>
<OPTION value="19">Hash_Sapphire320</OPTION>
<OPTION value="20">Hash_Snefru</OPTION>
<OPTION value="21">Hash_Square</OPTION>
<OPTION value="22">Hash_Tiger</OPTION>
<OPTION value="64">Hash_XOR16</OPTION>
<OPTION value="65">const csHash_XOR32</OPTION>
<OPTION value="66">const csHash_CRC16_CCITT</OPTION>
<OPTION value="67">const csHash_CRC16_Standard</OPTION>
<OPTION value="68">const csHash_CRC32</OPTION>
</SELECT></font></td>
</tr>
<tr>
<td width="50%" align="right"><font face="tahoma,arial" size="2"><b>Type
of result output</b></font></td>
<td width="50%"><font face="tahoma,arial"><SELECT size="1" name="TypeFormat1" 
id=TypeFormat1> 
<OPTION value="-1">None</OPTION>
<OPTION value="0">Copy</OPTION>
<OPTION value="1" selected>HEX</OPTION>
<OPTION value="2">MIME64</OPTION>
<OPTION value="3">UU</OPTION>
<OPTION value="4">XX</OPTION>
</SELECT></font></td>
</tr>
<tr>
<td width="50%" align="right"><font face="tahoma,arial" size="2"><b>Text
to Hash:</b></font></td>
<td width="50%"><font face="tahoma,arial"><INPUT NAME="txtHash" SIZE="30" value="This string will be hashed" id=txtHash LANGUAGE=javascript onclick="return txtHash_onclick()">
</font></td>
</tr>
<tr>
<td width="50%" align="right"></td>
<td width="50%"><font face="tahoma,arial"><INPUT TYPE="button" VALUE="Hash it!" id=btnHash name=btnHash LANGUAGE=javascript onclick="return btnHash_onclick()">
</font></td>
</tr>
<tr>
<td width="50%" align="right"><font face="tahoma,arial"><br>
<b>Result:</b></font></td>
<td width="50%"><TEXTAREA id=R1 name=R1 rows=4 cols=30></TEXTAREA></td>
</tr>
</table>
</center>
</div>
<p><font size="2" face="Tahoma,Arial"><b><u>Description</u></b><br>
This Option will get the field of the text to be hashed and will output
the hashed string on the Result field, you can play with the type of the
Hash and the format. If you mark the time output you will see the time
elapsed for the operation.</font></p></td>
</tr>
</table>
<P>&nbsp;</P>

<table border="1" width="100%" bgcolor="#808080" bordercolor="#000000" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#000080">
<p align="center"><b><font face="Tahoma,Arial" size="3" color="#ffffff">Cipher
a String</font></b></p></td>
</tr>
<tr>
<td width="100%">&nbsp;
<div align="center">
<center>
<table border="0">
<tr>
<td width="50%" align="right"><font face="tahoma,arial" size="2"><b>Type
of Ciphering:</b></font></td>
<td width="50%"><font face="tahoma,arial"><SELECT size="1" name="TypeCipher" 
id=TypeCipher> 
<OPTION value="128">Cipher_3Way</OPTION>
<OPTION value="129">Cipher_Blowfish</OPTION>
<OPTION value="130">Cipher_Gost</OPTION>
<OPTION value="131">Cipher_IDEA</OPTION>
<OPTION value="132">Cipher_Q128</OPTION>
<OPTION value="133">Cipher_SAFER_K40</OPTION>
<OPTION value="134">Cipher_SAFER_SK40</OPTION>
<OPTION value="135">Cipher_SAFER_K64</OPTION>
<OPTION value="136">Cipher_SAFER_SK64</OPTION>
<OPTION value="137">Cipher_SAFER_K128</OPTION>
<OPTION value="138">Cipher_SAFER_SK128</OPTION>
<OPTION value="139">Cipher_SCOP</OPTION>
<OPTION value="140">Cipher_Shark</OPTION>
<OPTION value="141">Cipher_Square</OPTION>
<OPTION value="142">Cipher_TEA</OPTION>
<OPTION value="143">Cipher_TEAN</OPTION>
<OPTION value="144">Cipher_Twofish</OPTION>
<OPTION value="145">Cipher_Cast128</OPTION>
<OPTION value="146">Cipher_Cast256</OPTION>
<OPTION value="147">Cipher_1DES</OPTION>
<OPTION value="148">Cipher_2DES</OPTION>
<OPTION value="149">Cipher_2DDES</OPTION>
<OPTION value="150">Cipher_3DES</OPTION>
<OPTION value="151">Cipher_3DDES</OPTION>
<OPTION value="152">Cipher_3TDES</OPTION>
<OPTION value="153">Cipher_DESX</OPTION>
<OPTION value="154">Cipher_Diamond2</OPTION>
<OPTION value="155">Cipher_Diamond2Lite</OPTION>
<OPTION value="156">Cipher_FROG</OPTION>
<OPTION value="157">Cipher_Mars</OPTION>
<OPTION value="158">Cipher_Misty</OPTION>
<OPTION value="159">Cipher_NewDES</OPTION>
<OPTION value="160">Cipher_RC2</OPTION>
<OPTION value="161">Cipher_RC4</OPTION>
<OPTION value="162" selected>Cipher_RC5</OPTION>
<OPTION value="163">Cipher_RC6</OPTION>
<OPTION value="164">Cipher_Rijndael</OPTION>
<OPTION value="165">Cipher_Sapphire</OPTION>
</SELECT>
</font></td>
</tr>
<tr>
<td width="50%" align="right"><font face="tahoma,arial" size="2"><b>Type
of result output</b></font></td>
<td width="50%"><font face="tahoma,arial"><SELECT size="1" name="TypeFormat2" 
id=TypeFormat2> 
<OPTION value="-1">None</OPTION>
<OPTION value="0">Copy</OPTION>
<OPTION value="1" selected>HEX</OPTION>
<OPTION value="2">MIME64</OPTION>
<OPTION value="3">UU</OPTION>
<OPTION value="4">XX</OPTION>
</SELECT></font></td>
</tr>
<tr>
<td width="50%" align="right"><font face="tahoma,arial" size="2"><b>Secured
password:</b></font></td>
<td width="50%"><font face="tahoma,arial"><INPUT NAME="txtPass" SIZE="30" value="My super secret password" id=txtPass>
</font></td>
</tr>
<tr>
<td width="50%" align="right"><font face="tahoma,arial" size="2"><b>Text
to Cipher:</b></font></td>
<td width="50%"><font face="tahoma,arial"><INPUT NAME="txtCipher" SIZE="30" value="I wish to be cipher" id=txtCipher>
</font></td>
</tr>
<tr>
<td width="50%" align="right"></td>
<td width="50%"><font face="tahoma,arial"><INPUT TYPE="button" VALUE="Cipher it!" id=btnCipher name=btnCipher LANGUAGE=javascript onclick="return btnCipher_onclick()">
</font></td>
</tr>
<tr>
<td width="50%" align="right"><font face="tahoma,arial"><br>
<b>Result:</b></font></td>
<td width="50%"><TEXTAREA name=R2 rows=4 cols=30></TEXTAREA></td>
</tr>
</table>
</center>
</div>
<p><font size="2" face="Tahoma,Arial"><b><u>Description</u></b><br>
This Option will Cipher the field of the text to be cipher in combination
with the secured password and will output the ciphered string on the
Result field, you can play with the type of the Cipher and the format. If
you mark the time output you will see the time elapsed for the operation.</font></p></td>
</tr>
</table>

<P><b><u><font face="Tahoma,Arial" size="2">Notes:</font></u></b></P>

<ul>
<li><font face="Tahoma,Arial" size="2">Check the security options on your browser to allow to use ActiveX or
Server objects on your machine.</font></li>
<li><font face="Tahoma,Arial" size="2">Register the ASPEasyCrypt with the
regsvr32 command, see instructions.</font></li>
<li><font face="Tahoma,Arial" size="2">Enable JavaScript, it has to be
compatible with major browser maybe with smalls modification let me known.</font></li>
<li><font face="Tahoma,Arial" size="2">To see the source code, just press on
your right button of your mouse and select display source code, or see it in
this link.</font></li>
</ul>

</BODY>
</HTML>