Hi to all,
i'm working on a PHP Framework to manage from PHP a connection with an HUB and with a CLIENT...
can be very usefull to write external BOTS.
I've added many things! I must complete it, i'm working on a callback system. The next thingh is enable this framework to connect to NMDC Hub (there is the LOCK) and connect to clients like DC++, DC and others, i want for example to analyze share lists, check share (incomplete files, vob, tmp and others), i want to reknow faked client and others!
i've tried to convert a function, from ragnarock, called Lock2Key.
there is my PHP code:
[code]
<?php
$lock = "szGNU\cjqxELSZahovCJQX_fmtAHOV]dkryFMT[bipwDK";
$key =lock2key($lock);
$key2 = "â€â€
PHP Framework
Moderator: Moderators
-
[RO]VeNoM
- Posts: 11
- Joined: 2003-05-04 19:36
Afret I modified a bit your code I get the same thing with my code :
[code]
//------------
// Decode Lock
//------------
function decode ($lock) {
$key = array ();
$lockLength = strlen ($lock);
$a1 = $lock[0];
$a2 = $lock[$lockLength - 1];
$a3 = $lock[$lockLength - 2];
$char1 = ord($a1) ^ ord($a2) ^ ord($a3) ^5;
$char2 = $char1;
$key[0]= $char2;
for ($i = 1; $i < $lockLength; $i++) {
$a5 = $lock[$i];
$a6 = $lock[$i-1];
$char3 = ord($a5) ^ ord($a6);
$char4 = $char3;
$key[$i] = $char4;
}
return $key;
}
function escapeChars($key) {
$encoded = '';
for ($i = 0; $i < count($key); $i++)
{
$a = $key[$i];
if ($a == '126' or // '~'
$a == '124' or // '|'
$a == '96' or // '`'
$a == '36' or // '$'
$a == '5' or // '^E'
$a == '0') // NUL
{
$encoded .= "/%DCN";
if ($a < 100)
$encoded .="0";
if ($a < 10)
$encoded .="0";
$encoded .= $a; // As a string integer
$encoded .= "%/";
} else {
$encoded .= pack("c",$a);; // No transformation.
}
}
return $encoded;
}
$lock = "-RM4dQR,CUj&(H5EFDhpOSdZX()PxL=V%e9=gj[l/1pSA;IaSi`V(A5+o`Tkx0@cE";
$Key = "à÷ñâ€â€
[code]
//------------
// Decode Lock
//------------
function decode ($lock) {
$key = array ();
$lockLength = strlen ($lock);
$a1 = $lock[0];
$a2 = $lock[$lockLength - 1];
$a3 = $lock[$lockLength - 2];
$char1 = ord($a1) ^ ord($a2) ^ ord($a3) ^5;
$char2 = $char1;
$key[0]= $char2;
for ($i = 1; $i < $lockLength; $i++) {
$a5 = $lock[$i];
$a6 = $lock[$i-1];
$char3 = ord($a5) ^ ord($a6);
$char4 = $char3;
$key[$i] = $char4;
}
return $key;
}
function escapeChars($key) {
$encoded = '';
for ($i = 0; $i < count($key); $i++)
{
$a = $key[$i];
if ($a == '126' or // '~'
$a == '124' or // '|'
$a == '96' or // '`'
$a == '36' or // '$'
$a == '5' or // '^E'
$a == '0') // NUL
{
$encoded .= "/%DCN";
if ($a < 100)
$encoded .="0";
if ($a < 10)
$encoded .="0";
$encoded .= $a; // As a string integer
$encoded .= "%/";
} else {
$encoded .= pack("c",$a);; // No transformation.
}
}
return $encoded;
}
$lock = "-RM4dQR,CUj&(H5EFDhpOSdZX()PxL=V%e9=gj[l/1pSA;IaSi`V(A5+o`Tkx0@cE";
$Key = "à÷ñâ€â€
-
daniele_dll
- Posts: 3
- Joined: 2003-05-08 20:01
- Location: Italy
Who is online
Users browsing this forum: Google [Bot] and 0 guests