Plugin Directory

Changeset 1395974


Ignore:
Timestamp:
04/14/2016 09:44:29 PM (10 years ago)
Author:
avdude
Message:

moved EVR_encryption class from evr_public-process_confirmation.php to evr_content.php

Location:
event-registration/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • event-registration/trunk/evr_content.php

    r1395971 r1395974  
    637637       return $string;
    638638}
     639class EVR_encryption {
     640    var $skey   = "eventregistraton"; // you can change it
     641   
     642    public  function safe_b64encode($string) {
     643   
     644        $data = base64_encode($string);
     645        $data = str_replace(array('+','/','='),array('-','_',''),$data);
     646        return $data;
     647    }
     648 
     649    public function safe_b64decode($string) {
     650        $data = str_replace(array('-','_'),array('+','/'),$string);
     651        $mod4 = strlen($data) % 4;
     652        if ($mod4) {
     653            $data .= substr('====', $mod4);
     654        }
     655        return base64_decode($data);
     656    }
     657   
     658    public  function encode($value){
     659       
     660        if(!$value){return false;}
     661        $text = $value;
     662        $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
     663        $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
     664        $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->skey, $text, MCRYPT_MODE_ECB, $iv);
     665        return trim($this->safe_b64encode($crypttext));
     666    }
     667   
     668    public function decode($value){
     669       
     670        if(!$value){return false;}
     671        $crypttext = $this->safe_b64decode($value);
     672        $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
     673        $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
     674        $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->skey, $crypttext, MCRYPT_MODE_ECB, $iv);
     675        return trim($decrypttext);
     676    }
     677}
     678
     679
    639680?>
  • event-registration/trunk/public/evr_public-process_confirmation.php

    r1395972 r1395974  
    8484}
    8585
    86 class EVR_encryption {
    87     var $skey   = "eventregistraton"; // you can change it
    88    
    89     public  function safe_b64encode($string) {
    90    
    91         $data = base64_encode($string);
    92         $data = str_replace(array('+','/','='),array('-','_',''),$data);
    93         return $data;
    94     }
    95  
    96     public function safe_b64decode($string) {
    97         $data = str_replace(array('-','_'),array('+','/'),$string);
    98         $mod4 = strlen($data) % 4;
    99         if ($mod4) {
    100             $data .= substr('====', $mod4);
    101         }
    102         return base64_decode($data);
    103     }
    104    
    105     public  function encode($value){
    106        
    107         if(!$value){return false;}
    108         $text = $value;
    109         $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
    110         $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
    111         $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->skey, $text, MCRYPT_MODE_ECB, $iv);
    112         return trim($this->safe_b64encode($crypttext));
    113     }
    114    
    115     public function decode($value){
    116        
    117         if(!$value){return false;}
    118         $crypttext = $this->safe_b64decode($value);
    119         $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
    120         $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
    121         $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->skey, $crypttext, MCRYPT_MODE_ECB, $iv);
    122         return trim($decrypttext);
    123     }
    124 }
    12586
    12687
Note: See TracChangeset for help on using the changeset viewer.