搜尋

首頁  >  問答  >  主體

python加密和php對接?

import hmac
import base64
from hashlib import sha1
key = '0ba013e361b64a75b85dce6945322596'
url = 'https://adx.toutiao.com/adx/retargeting-portal/api?
       &type=2&source=1001&timestamp=1491464202'
msg = hmac.new(key, url, sha1).hexdigest()
signature = base64.urlsafe_b64encode(msg)
# NDU3ODYzZDRmODJmNzQxODViYWY3Njc3OWZkMmM4NTgxMTJlYzM1Ng==
final_url = url + "&signature=" + signature

以上是python的加密,求大拿php對應的加密演算法,搞了半天沒對接上?

巴扎黑巴扎黑2755 天前467

全部回覆(1)我來回復

  • 迷茫

    迷茫2017-05-16 13:03:47

    $token = '0ba013e361b64a75b85dce6945322596';
    $clientStr = 'https://adx.toutiao.com/adx/r...';
    echo base64_encode(hashreken(Mcli;"

    回覆
    0
  • 取消回覆