Lenovo Yoga 7i 2in1 14IML9 0WID Intel Core Ultra 5Lenovo Yoga 7 2-in-1 14IML9 83DJ000WID ULTRA 5-125H/16GB/512GB/TS 14.0 OLED/WIN11+OHS2021/TIDAL TEAL - Yoga 7 2-in-1 14IML9 - Part Number : 83DJ000WID - PERFORMANCE: Processor Intel® Core™ Ultra 5 125H, 14C (4P + 8E + 2LPE) / 18T, Max Turbo up to 4.5GHz, 18MB - Graphics Integrated Intel® Arc™ Graphics - Chipset Intel® SoC Platform - Memory 16GB Soldered LPDDR5x-7467 Free Klik Disini ! |
Di tutorial ini kita belajar membuat enkripsi Symmetric Signature HMAC SHA512 menggunakan Python.
Beberapa library yang kita pakai diantaranya haslib, hmac dan base64.
import hashlib
import hmac
import base64
secretKey = "bulan-purnama-dikota-malang"
message = "test symmetric encryption"
hmac_digest = hmac.new(
key= bytes(secretKey, 'utf-8'),
msg= bytes(message, 'utf-8'),
digestmod= hashlib.sha512
).digest()
ubah ke base64 encode:
base64.b64encode(hmac_digest).decode()
hmac_digest = hmac.new(
key= bytes(secretKey, 'utf-8'),
msg= bytes(message, 'utf-8'),
digestmod= hashlib.sha512
).digest()
compare dengan compare_digest()
hmac.compare_digest(hmac_digest, base64.b64decode(signature))