oxdecryptor.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class oxDecryptor
00007 {
00008 
00017     public function decrypt($sString, $sKey)
00018     {
00019         $sKey = $this->_formKey($sKey, $sString);
00020 
00021         $sString = substr($sString, 3);
00022         $sString = str_replace('!', '=', $sString);
00023         $sString = base64_decode($sString);
00024         $sString = $sString ^ $sKey;
00025 
00026         return substr($sString, 2, -2);
00027     }
00028 
00037     protected function _formKey($sKey, $sString)
00038     {
00039         $sKey = '_' . $sKey;
00040         $iKeyLength = (strlen($sString) / strlen($sKey)) + 5;
00041 
00042         return str_repeat($sKey, $iKeyLength);
00043     }
00044 }