Sep-18-2022, 04:45 PM
(This post was last modified: Sep-18-2022, 04:52 PM by Yoriz.
Edit Reason: Added code tags
)
I need to convert a client's python code for generating a login code to something similar in FileMaker. I didn't think this could be done in FileMaker, but discovered some new functions that I think will work.
The code in python is:
I'm completely confused by the last line.
This generates the same code every time based on the ip in python. Everything that I've tried in FileMaker, using CryptAuthCode, CryptDigest and CryptEncryptBase64 or CryptDecryptBase64 creates a different code each time.
Thanks for any help you can provide.
Damian
The code in python is:
import sys
from hashlib import sha1
import hmac
import base64
def create_signature(secret_key):
hashed = hmac.new(secret_key, sha1)
return hashed
ip = 10.0.53.34
digest_str = "wordswords" + ip + "andmorewords"
hash = hmac.new("lg2acC8jnKcIFzGXVcLH3XlBmPNW4ypOnIE2OlSTFBw2sENEel7YuWP5Sojxjjp",
digest_str,
sha1)
b64_hash = base64.b64encode(hash.digest()).decode() I'm completely confused by the last line.
This generates the same code every time based on the ip in python. Everything that I've tried in FileMaker, using CryptAuthCode, CryptDigest and CryptEncryptBase64 or CryptDecryptBase64 creates a different code each time.
Thanks for any help you can provide.
Damian
