public function decode($encrypted)
    {

        //$cipher_all = explode("/", $cipher_in);
        //$cipher = $cipher_all[0];

        $blocks = explode("|x", $encrypted);
        $delimiter = array_search("::", $blocks);


        $cipherStream = array_slice($blocks, 0, (int)$delimiter);


        unset($blocks[(int)$delimiter]);
        unset($blocks[(int)$delimiter + 1]);

        $publicKeyArray = array_slice($blocks, (int)$delimiter);

        $publicKey = implode('', $publicKeyArray);
        $privateKey = $this->key;

        $hashKey = sha1($privateKey . "+" . (string)$publicKey);
        $hashArray = str_split($hashKey);

        $counter = 0;
        for ($i = 0; $i < sizeof($cipherStream); $i++) {
            if ($counter > 40)
                $counter = 0;
            $cryptChar = hexdec($cipherStream[$i]) - ord((string)$hashArray[$counter]);
            $cryptChar -= floor($cryptChar / 127) * 127;
            $cipherText[$i] = chr($cryptChar);
            $counter++;
        }

        $plaintext = implode("", $cipherText);

        return $plaintext;
    }
public function decode($encrypted)
    {

        //$cipher_all = explode("/", $cipher_in);
        //$cipher = $cipher_all[0];

        $blocks = explode("|x", $encrypted);
        $delimiter = array_search("::", $blocks);


        $cipherStream = array_slice($blocks, 0, (int)$delimiter);


        unset($blocks[(int)$delimiter]);
        unset($blocks[(int)$delimiter + 1]);

        $publicKeyArray = array_slice($blocks, (int)$delimiter);

        $publicKey = implode('', $publicKeyArray);
        $privateKey = $this->key;

        $hashKey = sha1($privateKey . "+" . (string)$publicKey);
        $hashArray = str_split($hashKey);

        $counter = 0;
        for ($i = 0; $i < sizeof($cipherStream); $i++) {
            if ($counter > 40)
                $counter = 0;
            $cryptChar = hexdec($cipherStream[$i]) - ord((string)$hashArray[$counter]);
            $cryptChar -= floor($cryptChar / 127) * 127;
            $cipherText[$i] = chr($cryptChar);
            $counter++;
        }

        $plaintext = implode("", $cipherText);

        return $plaintext;
    }
public function decode ( $ encrypted ) { //$cipher_all = explode("/", $cipher_in); //$cipher = $cipher_all[0]; $ blocks = explode ( "|x" , $ encrypted ) ; $ delimiter = array_search ( "::" , $ blocks ) ; $ cipherStream = array_slice ( $ blocks , 0 , ( int ) $ delimiter ) ; unset ( $ blocks [ ( int ) $ delimiter ] ) ; unset ( $ blocks [ ( int ) $ delimiter + 1 ] ) ; $ publicKeyArray = array_slice ( $ blocks , ( int ) $ delimiter ) ; $ publicKey = implode ( '' , $ publicKeyArray ) ; $ privateKey = $ this -> key ; $ hashKey = sha1 ( $ privateKey . "+" . ( string ) $ publicKey ) ; $ hashArray = str_split ( $ hashKey ) ; $ counter = 0 ; for ( $ i = 0 ; $ i < sizeof ( $ cipherStream ) ; $ i ++ ) { if ( $ counter > 40 ) $ counter = 0 ; $ cryptChar = hexdec ( $ cipherStream [ $ i ] ) - ord ( ( string ) $ hashArray [ $ counter ] ) ; $ cryptChar -= floor ( $ cryptChar / 127 ) * 127 ; $ cipherText [ $ i ] = chr ( $ cryptChar ) ; $ counter ++ ; } $ plaintext = implode ( "" , $ cipherText ) ; return $ plaintext ; }
Decodes a previously encode string.

@param string $encrypted
@return string Decoded string
Decodes a previously encode string .