-1

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

1
  • 1
    Any comment from the person who gave the down-vote?
    – dbf
    Dec 28, 2012 at 20:46

3 Answers 3

2

This is called obfuscation.

I can tell you this: don't do it.

It is quite easy to revert. Way easier than C++ - or any truely compiled language for that mather. You only fool yourself with this technique.

If you want to do it nevertheless, take a look at this: Is there a code obfuscator for PHP?

1
  • thank you, do you know which obfuscation methode this one (my code on above) is using
    – Vladimir
    Dec 28, 2012 at 20:56
1

You have to use a PHP obfuscator. Look at this question for more information.

1
  • thank you, do you know which obfuscation methode this one (my code on above) is using
    – Vladimir
    Dec 28, 2012 at 20:56
0

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!

2
  • thank you, but isn't there a way to automatically do this, i mean changing all "s65615il8e"s to "function1" for example instead of using replace-all in text editors
    – Vladimir
    Dec 28, 2012 at 21:51
  • 1
    yes. google php deobfuscation. i personally like the eval hook method php-security.org/2010/05/13/…
    – xero
    Jan 2, 2013 at 19:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.