當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Crypto::hmacSha1方法代碼示例

本文整理匯總了PHP中Crypto::hmacSha1方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypto::hmacSha1方法的具體用法?PHP Crypto::hmacSha1怎麽用?PHP Crypto::hmacSha1使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Crypto的用法示例。


在下文中一共展示了Crypto::hmacSha1方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: hmacSha1Verify

 public static function hmacSha1Verify($key, $in, $expected)
 {
     $hmac = Crypto::hmacSha1($key, $in);
     if ($hmac != $expected) {
         throw new GeneralSecurityException("HMAC verification failure");
     }
 }
開發者ID:dalinhuang,項目名稱:shopexts,代碼行數:7,代碼來源:Crypto.php

示例2: wrap

 /**
  * {@inheritDoc}
  */
 public function wrap(array $in)
 {
     $encoded = $this->serializeAndTimestamp($in);
     $cipherText = Crypto::aes128cbcEncrypt($this->cipherKey, $encoded);
     $hmac = Crypto::hmacSha1($this->hmacKey, $cipherText);
     $b64 = base64_encode($cipherText . $hmac);
     return $b64;
 }
開發者ID:jkinner,項目名稱:ringside,代碼行數:11,代碼來源:BasicBlobCrypter.php

示例3: testHmacSha1

 /**
  * Tests Crypto::hmacSha1()
  */
 public function testHmacSha1()
 {
     $string = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit';
     $key = 'Aliquam erat volutpat';
     $expected = '%16%E7%E0E%22%08%5C%2B48%85d%FE%DE%C7%3A%C3%0D%11c';
     $hmac = urlencode(Crypto::hmacSha1($key, $string));
     $this->assertEquals($expected, $hmac);
 }
開發者ID:ahmedadham88,項目名稱:enhanced-social-network,代碼行數:11,代碼來源:CryptoTest.php

示例4: wrap

 /**
  * {@inheritDoc}
  */
 public function wrap(array $in)
 {
     $encoded = $this->serializeAndTimestamp($in);
     if (!function_exists('mcrypt_module_open') && $this->allowPlaintextToken) {
         $cipherText = base64_encode($encoded);
     } else {
         $cipherText = Crypto::aes128cbcEncrypt($this->cipherKey, $encoded);
     }
     $hmac = Crypto::hmacSha1($this->hmacKey, $cipherText);
     $b64 = base64_encode($cipherText . $hmac);
     return $b64;
 }
開發者ID:react-epfl,項目名稱:moodle-shindig,代碼行數:15,代碼來源:BasicBlobCrypter.php

示例5: wrap

 /**
  * @see BasicBlobCrypter::warp()
  */
 public function wrap(array $in)
 {
     $encoded = $this->serializeAndTimestamp($in);
     if ($this->allowPlaintextToken) {
         $cipherText = base64_encode($encoded);
     } else {
         $cipherText = opShindigCrypto::encrypt($this->cipherKey, $encoded);
     }
     $hmac = Crypto::hmacSha1($this->hmacKey, $cipherText);
     $b64 = base64_encode($cipherText . $hmac);
     return $b64;
 }
開發者ID:niryuu,項目名稱:opOpenSocialPlugin,代碼行數:15,代碼來源:opShindigBlobCrypter.class.php


注:本文中的Crypto::hmacSha1方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。