From 6ea50c02da590ee1e6c800711fc59672d87b3885 Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Sun, 16 Mar 2025 18:29:15 -0700 Subject: [PATCH] Create timing_attack.py Signed-off-by: Eric Brown --- python/stdlib/timing_attack.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 python/stdlib/timing_attack.py diff --git a/python/stdlib/timing_attack.py b/python/stdlib/timing_attack.py new file mode 100644 index 0000000..591e25e --- /dev/null +++ b/python/stdlib/timing_attack.py @@ -0,0 +1,14 @@ +import hmac + + +received_digest = ( + b"\xe2\x93\x08\x19T8\xdc\x80\xef\x87\x90m\x1f\x9d\xf7\xf2" + b"\xf5\x10>\xdbf\xa2\xaf\xf7x\xcdX\xdf" +) + +key = b"my-super-duper-special-secret-key" +password = b"pass" +digest = hmac.digest(key, password, digest="sha224") + +if digest == received_digest: + print("Authentication okay")