Koaxia Game Hacking Board
Welcome, Guest. Please login or register.
Did you miss your activation email?
January 09, 2009, 05:33:27 AM

Login with username, password and session length
Search:     Advanced search
http://www.synrg-design.com
Partnered with Koaxia.

71488 Posts in 26880 Topics by 48644 Members
Latest Member: plexileantida
* Home Help Search Login Register
+  Koaxia Game Hacking Board
|-+  development
| |-+  Scripting
| | |-+  Hex Comparing...
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Hex Comparing...  (Read 901 times)
Kumash.Kxa™
Hero Member
*****
Offline Offline

Posts: 1824


Man is a universe within himself.


View Profile WWW
Hex Comparing...
« on: December 17, 2004, 12:01:30 PM »

This is a simple HEX comparing script, mostly for WPE'ers... so how it works? first, copy and paste all these codes and paste it on Notepad, then save it as what-ever-name-you-want.html, then you can compare HEX then... just tell me if you encounter an error or wish to suggest something...

kumashgore

Code:
<html>
<head>
<title></title>
</head>

<script language="JavaScript">
<!--
function compare(text1,text2)
{
 len = 0; ctr = 0; str = ''; error = 0;
 text1val = '<font size="2" face="courier new">'; text2val = '<font size="2" face="courier new">';
 if (text1.length >= text2.length) len=text1.length;
 else len=text2.length;
 for (x=0; x<len; x++)
 {
   if(text1.charAt(x) == text2.charAt(x))
   {
     if (text1.charAt(x) < ' ')
       if(ctr == 1)
       {
         text1val += '<br>';
         text2val += '<br>';
         ctr = 0;
       }
       else
         ctr++;
     else
       text1val += text1.charAt(x);
       text2val += text2.charAt(x);
   }
   else
   {
       text1val += '<font style="color:black; background: yellow;"><b>' + text1.charAt(x) + "</b></font>";
       text2val += '<font style="color:red; background: yellow;"><b>' + text2.charAt(x) + "</b></font>";
     error = 1;
   }
 }
 if(error == 0) alert('Done without errors!');
 else
   document.write('<table width="100%" border=1><tr><td width="50%" valign="top">' + text1val + '</td><td width="50%" valign="top">' + text2val + '</td></tr></table>');
}
-->
</script>

<body>
<form>
<textarea name="text1" cols="80" rows="5"></textarea><br><br><textarea name="text2" cols="80" rows="5"></textarea>
<br><br>
<input type="button" onclick="compare(text1.value,text2.value);" value=" Compare ">
</form>

</body>
</html>
Logged

...thx to geiko for my sig...

The Ring 2?
Zeny Making Bot
Shanks
Hero Member
*****
Offline Offline

Posts: 1214



View Profile WWW
Hex Comparing...
« Reply #1 on: December 17, 2004, 02:41:10 PM »

Good going... Keep up the good work if u want a rank up Grin
Logged





Just in love...
Kumash.Kxa™
Hero Member
*****
Offline Offline

Posts: 1824


Man is a universe within himself.


View Profile WWW
Hex Comparing...
« Reply #2 on: December 19, 2004, 03:04:51 AM »

Quote
Good going... Keep up the good work if u want a rank up ;D
[snapback]1199[/snapback]


thanks, and i already revised it with Hex subtracting and Hex adding, including Hex to Dec convertion and Dec to Hex convertion as well... ill be uploading it when my cable connection is fixed.

kumashgore.
Logged

...thx to geiko for my sig...

The Ring 2?
Zeny Making Bot
Kumash.Kxa™
Hero Member
*****
Offline Offline

Posts: 1824


Man is a universe within himself.


View Profile WWW
Hex Comparing...
« Reply #3 on: December 22, 2004, 07:21:30 AM »

Quote
thanks, and i already revised it with Hex subtracting and Hex adding, including Hex to Dec convertion and Dec to Hex convertion as well... ill be uploading it when my cable connection is fixed.

kumashgore.
[snapback]1279[/snapback]


Finally, here is the revised version... im open to suggestions and commens.

Code:
<html>
<head>
<title>All about HEX - by Kumashgore</title>
</head>

<script language="JavaScript">
<!--
var hexstr = '0123456789ABCDEF';
function compare(text1,text2)
{
 len = 0; ctr = 0; str = ''; error = 0;
 text1val = '<font size="2" face="courier new">'; text2val = '<font size="2" face="courier new">';
 if (text1.length >= text2.length) len=text1.length;
 else len=text2.length;
 for (x=0; x<len; x++)
 {
   if(text1.charAt(x) == text2.charAt(x))
   {
     if (text1.charAt(x) < ' ')
       if(ctr == 1)
       {
         text1val += '<br>';
         text2val += '<br>';
         ctr = 0;
       }
       else
         ctr++;
     else
       text1val += text1.charAt(x);
       text2val += text2.charAt(x);
   }
   else
   {
     text1val += '<font style="color:black; background: yellow;"><b>' + text1.charAt(x) + "</b></font>";
     text2val += '<font style="color:red; background: yellow;"><b>' + text2.charAt(x) + "</b></font>";
     error = 1;
   }
 }
 if(error == 0) alert('Done without errors!');
 else
   document.write('<table width="100%" border=1><tr><td width="50%" valign="top">' + text1val + '</td><td width="50%" valign="top">' + text2val + '</td></tr></table>');
}
function validatehex(hexval)
{
 if (hexstr.indexOf(hexval.charAt(0)) >= 0)
   if (hexstr.indexOf(hexval.charAt(1)) >= 0)
     if (hexval.length == 2)
return 1;
}
function h2dconvert(hexval)
{
 var hexvalue = 0;
 if (hexstr.indexOf(hexval.charAt(0)) >= 0)
   hexvalue += hexstr.indexOf(hexval.charAt(0)) * 16;
 if (hexstr.indexOf(hexval.charAt(1)) >= 0)
   hexvalue += hexstr.indexOf(hexval.charAt(1));
 return hexvalue;
}
function hextodec(hexval)
{
 if (validatehex(hexval) == 1)
   alert(hexval + ' = ' + h2dconvert(hexval));
 else
   alert('Please input correct Hex value (ex. 0E)');
}
function subhex(hex1, hex2)
{
 if (validatehex(hex1) + validatehex(hex2) == 2)
   alert(hex1 + '[' + h2dconvert(hex1) + ']' + ' - ' + hex2 + '[' + h2dconvert(hex2) + ']' + ' = ' + (h2dconvert(hex1) - h2dconvert(hex2)));
 else
   alert('Please input correct Hex value (ex. 0E)');
}
function d2hconvert(hexval)
{
 decvalue = hexstr.charAt(Math.floor(eval(hexval) / 16)) + hexstr.charAt(eval(hexval) % 16);
 return decvalue;
}
function dectohex(hexval)
{
 if ((hexval<=255) && (hexval != ' '))
   alert(hexval + ' = ' + d2hconvert(hexval));
 else
   alert('Please input number from 0-255.');
}
function addhex(hex1, hex2)
{
 if (validatehex(hex1) + validatehex(hex2) == 2)
   alert(hex1 + '[' + h2dconvert(hex1) + ']' + ' - ' + hex2 + '[' + h2dconvert(hex2) + ']' + ' = ' + (h2dconvert(hex1) + h2dconvert(hex2)));
 else
   alert('Please input correct Hex value (ex. 0E)');
}
-->
</script>

<body>
<form>
<center>
<font size="-1">All about HEX - by Kumashgore</font><br><br>
<table border="0" width="50%">
<tr><td align="center">
<textarea name="text1" cols="40" rows="4"></textarea><br><textarea name="text2" cols="40" rows="4"></textarea><br>
<input type="button" onclick="compare(text1.value,text2.value);" value="Compare Hex">
<br><br><hr>
<table border="0" width="100%">
<tr>
 <td><input type="text" name="hextodecval" size="2"> <input type="button" onclick="hextodec(hextodecval.value.toUpperCase());" value="Hex to Dec"></td>
 <td align="right"><input type="text" name="dectohexval" size="2"> <input type="button" onclick="dectohex(dectohexval.value);" value="Dec to Hex"></td>
</tr><tr>
 <td colspan="2"><hr></td>
</tr><tr>
 <td><input type="text" name="subhex1" size="2"> <input type="text" name="subhex2" size="2"> <input type="button" onclick="subhex(subhex1.value.toUpperCase(), subhex2.value.toUpperCase());" value="Subtract Hex"></td>
 <td align="right"><input type="text" name="addhex1" size="2"> <input type="text" name="addhex2" size="2"> <input type="button" onclick="addhex(addhex1.value.toUpperCase(), addhex2.value.toUpperCase());" value="Add Hex"></td>
</tr>
</table>
</td></tr>
</table>
</center>
</form>
</body>
</html>

kumashgore
Logged

...thx to geiko for my sig...

The Ring 2?
Zeny Making Bot
sykescone2
Underoath
Full Member
***
Offline Offline

Posts: 171


Duh... Duh... Duh.....


View Profile
Hex Comparing...
« Reply #4 on: March 27, 2005, 10:19:34 AM »

wow... this is good... im still studying about java and C++, this would be a nice sample to learn.. BRAIN FOOD nam nam nam...
Logged
Kumash.Kxa™
Hero Member
*****
Offline Offline

Posts: 1824


Man is a universe within himself.


View Profile WWW
Hex Comparing...
« Reply #5 on: March 29, 2005, 03:06:37 AM »

Quote
wow... this is good... im still studying about java and C++, this would be a nice sample to learn.. BRAIN FOOD nam nam nam...
[snapback]9198[/snapback]


thanks... work your way to the UD2, I have posted another stuff there for encypting/decrypting website source... /gg

Kumashgore
Logged

...thx to geiko for my sig...

The Ring 2?
Zeny Making Bot
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Koaxia Game Hacking Board | Powered by SMF 1.0.7.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!