Search code examples
phpzend-studio

How do i write(encrypt) my php code like this


I recently used ShowMyCode to deZend an old script to know how it works but after dezend, all of the 1000 lines appeared like this

function s65615il8e( $IlbXmxb915, $B94omi07x1 = 0, $i4ss65VOR0 = 0 )
{
$JleV65B6RB = array( "1276" => "period", "4126" => "V2_HASH" );
if ( 0 < $B94omi07x1 || 0 < $i4ss65VOR0 )
{
    return substr( $JleV65B6RB[$IlbXmxb915], $B94omi07x1, $i4ss65VOR0 );
}
return $JleV65B6RB[$IlbXmxb915];
}

function e4l9roibmi( $xolsL1jB0i, $dBXj7eREB6 = 0, $oR609Xb5oV = 0 )
{
$wewOBeEdoe = array( "4126" => "B8REXV4YAS6A9WVBNFEV", "1276" => "76GDKGBBKZRJ597W8F7T" );
if ( 0 < $dBXj7eREB6 || 0 < $oR609Xb5oV )
{
    return substr( $wewOBeEdoe[$xolsL1jB0i], $dBXj7eREB6, $oR609Xb5oV );
}
return $wewOBeEdoe[$xolsL1jB0i];
}

as you can see its completely unreadable,

what is this method called and how can i encrypt my php code like that


Solution

  • the idea of obfuscation is making code unreadable.

    so this probably isn't what you want. but here's the code de-obfuscated

    function function1( $var1, $var2 = 0, $var3 = 0 ) {
        $array1 = array( "1276" => "period", "4126" => "V2_HASH" );
        if ( 0 < $var2 || 0 < $var3 ) {
            return substr( $array1[$var1], $var2, $var3 );
        }
        return $array1[$var1];
    }
    
    function function2( $var1, $var2 = 0, $var3 = 0 ) {
        $array1 = array( "4126" => "B8REXV4YAS6A9WVBNFEV", "1276" => "76GDKGBBKZRJ597W8F7T" );
        if ( 0 < $var2 || 0 < $var3 ) {
            return substr( $array1[$var1], $var2, $var3 );
        }
        return $array1[$var1];
    }
    

    there's no what of knowing what the old function/variable names where. but it's much easier to read what they are doing now. hope that helps!