How to compare in python an input value with an hashed value in mysql table?

Growth Hacking Formation admin at formationgrowthhacking.com
Tue Jan 14 13:02:08 EST 2020


Thanks for your help.

Litle details,

the license key is goldQ3T8-1QRD-5QBI-9F22

and it is stored in database already encrypted.
License key is not saved in database with clear text. It is already encrypted. I am not sure what is this hash column for?

License key =>
def50200962018b6bbed50fc53abca6bb076eb2947fc379e69bd38dcea9f8fbe29eedd43f1148e721d5f6657d8d0152356f5a7ba566dde545a9a354c7b42af88fe4ea7775a4e2ee1a26d8b8f7e3272cf5a8bbe38197fdf19e1726d5e2d769bae408cd511706388abad5a75

hash =>
25138e045e9f50022331340a26d0eecbd0d7ca6bfefee0275749025c4f56c3a8
see screenshot:
http://prntscr.com/qnhz8h

I thought the "hash" column was the key to encrypt or decrypt the license stored in column "license_key".


So I run your code for testing with appropriate licese key:
Python Code: 
1
2
3
4
5
6	from hashlib import md5, sha256, sha512
 
key = 'goldQ3T8-1QRD-5QBI-9F22'
 
for hash_func in (md5, sha256, sha512):
    print(hash_func(key.encode()).hexdigest())
and it give this outpu:
Output:
ecc58b55c33fe6dfe3b49d6d63aad65b
f67e701240fbd964aa9a0eb81e2f549b8e3dd97e1aa3b1f5796fd12cd9b14005
8288f635fbab6d6511fc5aa63caf153fa434b3d351612cdf48dcf6abea4275cde5f0d6fffda2e7c6fd42350483603cf6959dd62c946eea2b75eca9f60a5cf5b7

Process finished with exit code 0
As you can see, here the code doesn't give same result than database.

=======================================

Regarding wordpress login, I didn't find any python library which can can handle this authentification process.

I contacted the developper, and he replied me this message:


####################
Hello @formationgrowthhacking,
thank you for your message and for using my plugin.
For license key hashing, I implemented the PHP native method hash_hmac(), using the sha256 algorithm.
You can check out the class which is responsible for encryption, decryption, and hashing here:
https://plugins.trac.wordpress.org/browser/license-manager-for-woocommerce/trunk/includes/Crypto.php
Let me know if this helped!
###########

But he may not know python. I need help of python expert.

Does this update help for better understanding my issue?



More information about the Python-list mailing list