oxdecryptor.php

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