Created
March 2, 2017 16:25
-
-
Save tkizm1/e138e93085c7375923413478adc01f0f to your computer and use it in GitHub Desktop.
hmac sha256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
payload = '''{ | |
"ref": "refs/heads/master", | |
"before": "337fb2355f43dd74cb8d77fcd083854092086e57", | |
"after": "337fb2355f43dd74cb8d77fcd083854092086e57", | |
"compare_url": "", | |
"commits": [ | |
{ | |
"id": "337fb2355f43dd74cb8d77fcd083854092086e57", | |
"message": "Initial commit\n", | |
"url": "https://try.gogs.io/unknwon/hello/commit/337fb2355f43dd74cb8d77fcd083854092086e57", | |
"author": { | |
"name": "无闻", | |
"email": "[email protected]", | |
"username": "unknwon" | |
}, | |
"committer": { | |
"name": "Gogs", | |
"email": "[email protected]", | |
"username": "" | |
}, | |
"timestamp": "0001-01-01T00:00:00Z" | |
} | |
], | |
"repository": { | |
"id": 8427, | |
"owner": { | |
"id": 1, | |
"login": "unknwon", | |
"full_name": "Unknwon", | |
"email": "[email protected]", | |
"avatar_url": "https://secure.gravatar.com/avatar/d8b2871cdac01b57bbda23716cc03b96", | |
"username": "unknwon" | |
}, | |
"name": "hello", | |
"full_name": "unknwon/hello", | |
"description": "", | |
"private": false, | |
"fork": false, | |
"html_url": "https://try.gogs.io/unknwon/hello", | |
"ssh_url": "[email protected]:unknwon/hello.git", | |
"clone_url": "https://try.gogs.io/unknwon/hello.git", | |
"website": "", | |
"stars_count": 0, | |
"forks_count": 0, | |
"watchers_count": 1, | |
"open_issues_count": 1, | |
"default_branch": "master", | |
"created_at": "2017-02-21T16:14:55Z", | |
"updated_at": "2017-02-21T16:14:55Z" | |
}, | |
"pusher": { | |
"id": 1, | |
"login": "unknwon", | |
"full_name": "Unknwon", | |
"email": "[email protected]", | |
"avatar_url": "https://secure.gravatar.com/avatar/d8b2871cdac01b57bbda23716cc03b96", | |
"username": "unknwon" | |
}, | |
"sender": { | |
"id": 1, | |
"login": "unknwon", | |
"full_name": "Unknwon", | |
"email": "[email protected]", | |
"avatar_url": "https://secure.gravatar.com/avatar/d8b2871cdac01b57bbda23716cc03b96", | |
"username": "unknwon" | |
} | |
}''' | |
import hmac | |
import hashlib | |
import base64 | |
print hmac.new('111111', msg=payload, digestmod=hashlib.sha256).hexdigest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment