Skip to content

Instantly share code, notes, and snippets.

@akionsight
Created October 17, 2020 05:58
Show Gist options
  • Save akionsight/6e4148bd52d315a00daecd070d4f4f28 to your computer and use it in GitHub Desktop.
Save akionsight/6e4148bd52d315a00daecd070d4f4f28 to your computer and use it in GitHub Desktop.
secrets.compare_digest exaample
import secrets
equal_str = '9oKOSmTqT8Kn2BnpZ7qIs7JjTleGeXa119rMfxFdoDg5zeqInGT5NMWK_y0mI2U_ldbFaiSnsfDtwMSiBGvaKCvBL7wnXkW'
unequeal_str = '74K2Xps1O2om5ujSWxtgq449D4_RmHGSqH2HIJgM_m4YclfhxR0LHJTtnt-9obVC8gJOXLrCzVL63OuK6Qc_BcLJioNPm4Yjz'
print(secrets.compare_digest(equal_str, equeal_str)) ## True
print(secrets.compare_digest(equal_str, unequeal_str)) ## False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment