mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-02 20:17:35 +08:00
chore: sort imports in the Markdown examples (#3822)
This commit is contained in:
parent
b17feb59bb
commit
a2b69b1530
@ -24,9 +24,9 @@ title: HMAC Generate Signature Examples
|
|||||||
## Python 3
|
## Python 3
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import base64
|
|
||||||
|
|
||||||
secret = bytes('the shared secret key here', 'utf-8')
|
secret = bytes('the shared secret key here', 'utf-8')
|
||||||
message = bytes('this is signature string', 'utf-8')
|
message = bytes('this is signature string', 'utf-8')
|
||||||
@ -46,8 +46,8 @@ base64.b64encode(hash.digest())
|
|||||||
```java
|
```java
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
import javax.xml.bind.DatatypeConverter;
|
import javax.xml.bind.DatatypeConverter;
|
||||||
|
|
||||||
class Main {
|
class Main {
|
||||||
@ -103,8 +103,8 @@ func main() {
|
|||||||
## Ruby
|
## Ruby
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
require 'openssl'
|
|
||||||
require 'base64'
|
require 'base64'
|
||||||
|
require 'openssl'
|
||||||
|
|
||||||
secret = 'the shared secret key here'
|
secret = 'the shared secret key here'
|
||||||
message = 'this is signature string'
|
message = 'this is signature string'
|
||||||
|
@ -168,9 +168,9 @@ Note: The last request header also needs + `\n`.
|
|||||||
Use Python to generate the signature `SIGNATURE`:
|
Use Python to generate the signature `SIGNATURE`:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import base64
|
|
||||||
|
|
||||||
secret = bytes('my-secret-key', 'utf-8')
|
secret = bytes('my-secret-key', 'utf-8')
|
||||||
message = bytes("""GET
|
message = bytes("""GET
|
||||||
|
@ -162,9 +162,9 @@ x-custom-a:test
|
|||||||
使用 Python 来生成签名 `SIGNATURE`:
|
使用 Python 来生成签名 `SIGNATURE`:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import base64
|
|
||||||
|
|
||||||
secret = bytes('my-secret-key', 'utf-8')
|
secret = bytes('my-secret-key', 'utf-8')
|
||||||
message = bytes("""GET
|
message = bytes("""GET
|
||||||
|
Loading…
Reference in New Issue
Block a user