Created
March 27, 2020 22:56
-
-
Save yokrysty/7e977f2cef037af74e3ddc911e0beef6 to your computer and use it in GitHub Desktop.
RO Health Card CID from CNP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hmac | |
import hashlib | |
def gen_cid(cnp): | |
return '40' + str(int(hmac.new( | |
hashlib.sha256('CID'.encode()).digest(), | |
cnp.encode(), | |
hashlib.sha256 | |
).hexdigest()[:16], 16))[:-2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment