Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class sagepay {
  2.  
  3. public $encryptPassword = 'djgktifhtjriekfj';
  4.  
  5. protected function encryptAndEncode($strIn) {
  6. $strIn = $this->pkcs5_pad($strIn, 16);
  7. echo $strIn;
  8. return "@".bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->encryptPassword, $strIn, MCRYPT_MODE_CBC, $this->encryptPassword));
  9. }
  10.  
  11. protected function pkcs5_pad($text, $blocksize) {
  12. $pad = $blocksize - (strlen($text) % $blocksize);
  13. return $text . str_repeat(chr($pad), $pad);
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement