uu.HmacSHA256(JSON.stringify(e), t).toString(uu.enc.Base64)
def demo2(t, account, password, rsaKey): import hmac import hashlib import base64 aaa = f'{{"account":"{account}","password":"{password}","rsaKey":"{rsaKey}"}}' return base64.b64encode( hmac.new(bytes(t, 'utf-8'), bytes(aaa, 'utf-8'), digestmod=hashlib.sha256).digest()).decode('utf-8') if __name__ == '__main__': t = '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAglTqmmWBBBAv+xIvDXCZ\nNSyzIT/4pHbzqlB/A8awIh0VXd2rbX7gQ4a5Ks6CHHNITj8+fvsyLipy3PXVtrCl\n3K1VOl9eA3y4z2tC6gevv7amu7p9UsQEWUrgqieMKmOWKNVL8tvkTAGg5vMBo2yQ\nPR+WuGPRTHoBz/SlDzbhBzfcHRW3MvLMJAHr3fMOweNsGTRIxpxeveZYZuiPYktE\nsZVv+zh8w4y8EDRpIV/NSDyP8lsIBBlounkTEfcBN8Nu8NsahYVH8TDR0Ds3f1jS\ne0EGMBG+gIHRIINhJySx5J+jvjJoyLg+uy67oY/dDTRPiB/n2l9jZzT/VJKCsVms\nOwIDAQAB\n-----END PUBLIC KEY-----' ss = demo2(t, "admin", "fqSS52zKYL874qiGHpnx/TVKYKktLfvJNQ7kxcUwAqwuvoLbXAhkgqucmrEQPgRVAZClNelhST9YSZrtgnz15Q3ZUtUkZpfx67xASTA/jaBkZHlLSYoV0/Okh/D20i2bPfUIKEg/7GemWSo/1IPg/YSuqcUiRO/IkRoGIBkyhN38JtDV2S5USFFmoZZEF/eWvCugNtEL8hE91LIB74gZuM3SrBubarNaujFJuvRX52hbmfzuKy5YPKHvYrV5brYj/S2r858BG/hLftj9vp7Pva6wo/4sgRwU0NRmFm2invuKtI/Ptw2HqkdJVwc3clpQdcfGCFeaH2QrmwxHOZp6jQ==", "58cb67fef21c419f8fdb0a7aad944fc4") print(ss)
标签:__,account,python,rsaKey,HmacSHA256,js,-----,import From: https://www.cnblogs.com/angdh/p/17789933.html