OXID eShop CE  4.9.7
 All Classes Files Functions Variables Pages
oxencryptor.php
Go to the documentation of this file.
1 <?php
2 
7 {
8 
17  public function encrypt($sString, $sKey)
18  {
19  $sString = "ox{$sString}id";
20 
21  $sKey = $this->_formKey($sKey, $sString);
22 
23  $sString = $sString ^ $sKey;
24  $sString = base64_encode($sString);
25  $sString = str_replace("=", "!", $sString);
26 
27  return "ox_$sString";
28  }
29 
38  protected function _formKey($sKey, $sString)
39  {
40  $sKey = '_' . $sKey;
41  $iKeyLength = (strlen($sString) / strlen($sKey)) + 5;
42 
43  return str_repeat($sKey, $iKeyLength);
44  }
45 }