Skip to content

Instantly share code, notes, and snippets.

@yokrysty
Created March 27, 2020 22:56
Show Gist options
  • Save yokrysty/7e977f2cef037af74e3ddc911e0beef6 to your computer and use it in GitHub Desktop.
Save yokrysty/7e977f2cef037af74e3ddc911e0beef6 to your computer and use it in GitHub Desktop.
RO Health Card CID from CNP
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