Changeset 1395974
- Timestamp:
- 04/14/2016 09:44:29 PM (10 years ago)
- Location:
- event-registration/trunk
- Files:
-
- 2 edited
-
evr_content.php (modified) (1 diff)
-
public/evr_public-process_confirmation.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
event-registration/trunk/evr_content.php
r1395971 r1395974 637 637 return $string; 638 638 } 639 class 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 639 680 ?> -
event-registration/trunk/public/evr_public-process_confirmation.php
r1395972 r1395974 84 84 } 85 85 86 class EVR_encryption {87 var $skey = "eventregistraton"; // you can change it88 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 }125 86 126 87
Note: See TracChangeset
for help on using the changeset viewer.