Skip to content

Commit fde2adb

Browse files
authored
Create signature
1 parent 9d46179 commit fde2adb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

signature

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'''
2+
php server:
3+
$hmac_sha1_str = base64_encode(hash_hmac("sha1", $string_to_sign, $secret_access_key));
4+
$signature = urlencode($hmac_sha1_str);
5+
'''
6+
# python client
7+
8+
import urllib,base64,hmac,hashlib
9+
secret_access_key='tNEA6EfI3aqd2Ko'
10+
string_to_sign='aaa'
11+
12+
13+
signature = urllib.quote(
14+
base64.b64encode(
15+
hmac.new(secret_access_key, string_to_sign, digestmod=hashlib.sha1)
16+
.hexdigest()
17+
))
18+
19+
20+
print signature

0 commit comments

Comments
 (0)