encryptBase64() public method

Encrypts a text returning the result as a base64 string
public encryptBase64 ( string $text, mixed $key = null, boolean $safe = false ) : string
$text string
$key mixed
$safe boolean
return string
示例#1
0
 /**
  * Tests the encryption base 64
  *
  * @author Nikolaos Dimopoulos <*****@*****.**>
  * @since  2014-10-17
  */
 public function testCryptEncryptBase64()
 {
     $this->specify("encryption base 64does not return correct results", function () {
         $crypt = new Crypt();
         $crypt->setPadding(Crypt::PADDING_ANSI_X_923);
         $key = substr('phalcon notice 13123123', 0, 16);
         $expected = 'https://github.com/phalcon/cphalcon/issues?state=open';
         $encrypted = $crypt->encryptBase64($expected, substr($key, 0, 16));
         expect($crypt->decryptBase64($encrypted, $key))->equals($expected);
         $encrypted = $crypt->encryptBase64($expected, $key, true);
         expect($crypt->decryptBase64($encrypted, $key, true))->equals($expected);
     });
 }