python encryption and php docking?
巴扎黑
巴扎黑 2017-05-16 13:01:47
0
1
508
import hmac
import base64
from hashlib import sha1
key = '0ba013e361b64a75b85dce6945322596'
url = 'https://adx.toutiao.com/adx/retargeting-portal/api?
       &type=2&source=1001×tamp=1491464202'
msg = hmac.new(key, url, sha1).hexdigest()
signature = base64.urlsafe_b64encode(msg)
# NDU3ODYzZDRmODJmNzQxODViYWY3Njc3OWZkMmM4NTgxMTJlYzM1Ng==
final_url = url + "&signature=" + signature

The above is the encryption of Python. Please tell me the encryption algorithm corresponding to PHP. I have been working on it for a long time and I still can’t connect it?

巴扎黑
巴扎黑

reply all(1)
迷茫

$token = '0ba013e361b64a75b85dce6945322596';
$clientStr = 'https://adx.toutiao.com/adx/r...';
echo base64_encode(hash_hmac("SHA1",$clientStr,$token));

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template