oxencryptor.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class oxEncryptor
00007 {
00015     public function encrypt($sString, $sKey)
00016     {
00017         $sString = "ox{$sString}id";
00018 
00019         $sKey = $this->_formKey($sKey, $sString);
00020 
00021         $sString = $sString ^ $sKey;
00022         $sString = base64_encode ( $sString );
00023         $sString = str_replace( "=", "!", $sString );
00024 
00025         return "ox_$sString";
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 
00043 }