-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

Vladimir
  • 1,602
  • 2
  • 18
  • 40

3 Answers3

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?

Community
  • 1
  • 1
1

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

Community
  • 1
  • 1
antoyo
  • 11,097
  • 7
  • 51
  • 82
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!

xero
  • 4,077
  • 22
  • 39
  • 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 '12 at 21:51
  • 1
    yes. google php deobfuscation. i personally like the eval hook method http://php-security.org/2010/05/13/article-decoding-a-user-space-encoded-php-script/ – xero Jan 02 '13 at 19:47