mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Update TimingAttackAgainstHash.py
This commit is contained in:
@@ -11,10 +11,10 @@ key = "e179017a-62b0-4996-8a38-e91aa9f1"
|
||||
def sign(pre_key, msg, alg):
|
||||
return hmac.new(pre_key, msg, alg).digest()
|
||||
|
||||
def verify1(msg, sig):
|
||||
def VerifyGood(msg, sig):
|
||||
return constant_time_string_compare(sig, sign(key, msg, hashlib.sha256)) #good
|
||||
|
||||
def verify2(msg, sig):
|
||||
def verifyBad(msg, sig):
|
||||
return sig == sign(key, msg, hashlib.sha256) #bad
|
||||
|
||||
def constant_time_string_compare(a, b):
|
||||
|
||||
Reference in New Issue
Block a user