File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,9 @@ title: HMAC Generate Signature Examples
24
24
## Python 3
25
25
26
26
``` python
27
+ import base64
27
28
import hashlib
28
29
import hmac
29
- import base64
30
30
31
31
secret = bytes (' the shared secret key here' , ' utf-8' )
32
32
message = bytes (' this is signature string' , ' utf-8' )
@@ -46,8 +46,8 @@ base64.b64encode(hash.digest())
46
46
``` java
47
47
import javax.crypto.Mac ;
48
48
import javax.crypto.spec.SecretKeySpec ;
49
- import java.security.NoSuchAlgorithmException ;
50
49
import java.security.InvalidKeyException ;
50
+ import java.security.NoSuchAlgorithmException ;
51
51
import javax.xml.bind.DatatypeConverter ;
52
52
53
53
class Main {
@@ -103,8 +103,8 @@ func main() {
103
103
## Ruby
104
104
105
105
``` ruby
106
- require ' openssl'
107
106
require ' base64'
107
+ require ' openssl'
108
108
109
109
secret = ' the shared secret key here'
110
110
message = ' this is signature string'
Original file line number Diff line number Diff line change @@ -168,9 +168,9 @@ Note: The last request header also needs + `\n`.
168
168
Use Python to generate the signature ` SIGNATURE ` :
169
169
170
170
``` python
171
+ import base64
171
172
import hashlib
172
173
import hmac
173
- import base64
174
174
175
175
secret = bytes (' my-secret-key' , ' utf-8' )
176
176
message = bytes (""" GET
Original file line number Diff line number Diff line change @@ -162,9 +162,9 @@ x-custom-a:test
162
162
使用 Python 来生成签名 ` SIGNATURE ` :
163
163
164
164
``` python
165
+ import base64
165
166
import hashlib
166
167
import hmac
167
- import base64
168
168
169
169
secret = bytes (' my-secret-key' , ' utf-8' )
170
170
message = bytes (""" GET
You can’t perform that action at this time.
0 commit comments