ok im not sure if anyone here might know ASP and PHP but i need help so hope someone can help. I need to conert an ASP classic file to PHP ive tried asp2php but it cant fix this file
<ASP>
<%
public function encrypt(password)
dim key(16)
dim one,two,three,four
dim i
dim dstbytes(16)
bu_String2Bytes password, key
bu_String2Bytes password, dstbytes
one= bu_Bytes2Int(key, 0) * 213119 + 2529077
one = one - Fix(one/ 4294967296) * 4294967296
two = bu_Bytes2Int(key, 4) * 213247 + 2529089
two = two - Fix(two/ 4294967296) * 4294967296
three = bu_Bytes2Int(key, 8) * 213203 + 2529589
three = three - Fix(three/ 4294967296) * 4294967296
four = bu_Bytes2Int(key, 12) * 213821 + 2529997
four = four - Fix(four/ 4294967296) * 4294967296
call MyuwSplit(one, key(0), key(1), key(2), key(3))
call MyuwSplit(two, key(4), key(5), key(6), key(7))
call MyuwSplit(three, key(8), key(9), key(10), key(11))
call MyuwSplit(Four, key(12), key(13), key(14), key(15))
dstbytes(0) = dstbytes(0) xor key(0)
for i=1 to 15
dstbytes(i) = dstbytes(i) xor dstbytes(i-1) xor key(i and 15)
next
for i=0 to 15
if dstbytes(i) = 0 then
dstbytes(i) = &H66
end if
next
encrypt = "0x"
for i=0 to 15
if dstbytes(i) < &H10 then
encrypt = encrypt & "0" & Hex(dstbytes(i))
else
encrypt = encrypt & Hex(dstbytes(i))
end if
next
end function
Public Sub MyuwSplit(ByRef w, a, b, C, d)
d = Fix(w / &H1000000)
c = Fix((w - d * &H1000000) / &H10000)
b = Fix((w - d * &H1000000 - c * &H10000) / &H100)
a = Fix((w - d * &H1000000 - c * &H10000 - b * &H100))
End Sub
public Function bu_Bytes2Int(aBytes(), index)
dim rslt
rslt = aBytes(index) + aBytes(index+1)*256 + aBytes(index+2)*65536 + aBytes(index+3)*16777216
bu_Bytes2Int = rslt
End Function
Public Function bu_String2Bytes(str, aBytes())
nBytes = Len(str)
For i = 0 To nBytes - 1
aBytes(i) = Asc(Mid(str, i + 1, 1))
Next
bu_String2Bytes = nBytes
End Function
%>
<PHP (what i have got from me hacking and asp2php prob. ALL wrong)>
<?
function encrypt($password)
{
bu_String2Bytes($password,$key);
bu_String2Bytes($password,$dstbytes);
$one = bu_Bytes2Int($key,0) * 213119 + 2529077;
$one = $one - $Fix[$one / 4294967296] * 4294967296;
$two = bu_Bytes2Int($key,4)*213247 + 2529089;
$two = $two - $Fix[$two / 4294967296] * 4294967296;
$three = bu_Bytes2Int($key,8)*213203 + 2529589;
$three = $three - $Fix[$three / 4294967296] * 4294967296;
$four = bu_Bytes2Int($key,12)*213821 + 2529997;
$four = $four - $Fix[$four / 4294967296] * 4294967296;
MyuwSplit($one,$key[0],$key[1],$key[2],$key[3]);
MyuwSplit($two,$key[4],$key[5],$key[6],$key[7]);
MyuwSplit($three,$key[8],$key[9],$key[10],$key[11]);
MyuwSplit($Four,$key[12],$key[13],$key[14],$key[15]);
$dstbytes[0]=$dstbytes[0]^$key[0];
for ($i=1; $i<=15; $i=$i+1)
{
$dstbytes[$i]=$dstbytes[$i]^$dstbytes[$i-1]^$key[$i&15];
}
for ($i=0; $i<=15; $i=$i+1)
{
if ($dstbytes[$i]==0)
{
$dstbytes[$i]=0x66;
}
}
$encrypt="0x";
for ($i=0; $i<=15; $i=$i+1)
{
if ($dstbytes[$i]<0x10)
{
$encrypt=$encrypt."0".$Hex[$dstbytes[$i]];
}
else
{
$encrypt=$encrypt.$Hex[$dstbytes[$i]];
}
}
return $function_ret;
}
function MyuwSplit(&$w,&$a,&$b,&$C,&$d)
{
$d=$Fix[$w/0x1000000];
$c=$Fix[($w-$d*0x1000000)/0x10000];
$b=$Fix[($w-$d*0x1000000-$c*0x10000)/0x100];
$a=$Fix[($w-$d*0x1000000-$c*0x10000-$b*0x100)];
return $function_ret;
}
function bu_Bytes2Int($aBytes,$index)
{
$rslt=$aBytes[$index]+$aBytes[$index+1]*256+$aBytes[$index+2]*65536+$aBytes[$index+3]*16777216;
return $rslt;
}
function bu_String2Bytes($str,$aBytes)
{
extract($GLOBALS);
$nBytes=strlen($str);
for ($i=0; $i<=$nBytes-1; $i=$i+1)
{
$aBytes[$i]=ord(substr($str,$i+1-1,1));
}
return $nBytes;
}
echo encrypt("PASSWORD");
?>
im really stuck on the asp fix() function im not sure what it does ro what I would use in PHP right now it gives no errors but i can already see that the "return $function_ret;" wont return anything unless asp2php knows soomething i dont know about function returns
anyway If someone can hack at this i would greatly like it
thanks in advance