Skip to content

Instantly share code, notes, and snippets.

@ardzz
Last active February 11, 2025 13:55
Show Gist options
  • Save ardzz/5287638cca46920b0e413e2264bc4f42 to your computer and use it in GitHub Desktop.
Save ardzz/5287638cca46920b0e413e2264bc4f42 to your computer and use it in GitHub Desktop.

Revisions

  1. ardzz revised this gist Feb 11, 2025. 2 changed files with 3 additions and 3 deletions.
    2 changes: 1 addition & 1 deletion hmac_generator.py
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ def generate_hmac(key, message):
    return hashlib.sha256(key.encode() + message.encode()).hexdigest()


    data = {"name": "Reky", "email": "reky@cy0x1.id"}
    data = {"name": "Reky", "email": "reky@cby0x1.id"}
    data_json = json.dumps(data)

    print("Data JSON:", data_json)
    4 changes: 2 additions & 2 deletions hmac_http_request.http
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,6 @@ PUT /profile HTTP/1.1
    Host: api.reky.id
    Content-Type: application/json
    Date: Tue, 11 Feb 2025 12:00:00 GMT
    Hmac: 3a188613de0d4d402b7260a52998042f0d5774e2936c88bfb51d166c6de6b2fa
    Hmac: 63b840b5a5d3a4ea3c203571fa4489952aad23050056fc01391e24ef804b4c25

    {"name": "Reky","email": "reky@cy0x1.id"}
    {"name": "Reky","email": "reky@cyb0x1.id"}
  2. ardzz created this gist Feb 11, 2025.
    13 changes: 13 additions & 0 deletions hmac_generator.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    import hashlib
    import json


    def generate_hmac(key, message):
    return hashlib.sha256(key.encode() + message.encode()).hexdigest()


    data = {"name": "Reky", "email": "[email protected]"}
    data_json = json.dumps(data)

    print("Data JSON:", data_json)
    print("HMAC:", generate_hmac("very_secret", data_json))
    7 changes: 7 additions & 0 deletions hmac_http_request.http
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    PUT /profile HTTP/1.1
    Host: api.reky.id
    Content-Type: application/json
    Date: Tue, 11 Feb 2025 12:00:00 GMT
    Hmac: 3a188613de0d4d402b7260a52998042f0d5774e2936c88bfb51d166c6de6b2fa

    {"name": "Reky","email": "[email protected]"}