|
|
|
|
|
by rakoo
4350 days ago
|
|
key_data = hashlib.sha256()
key_data.update( base_phrase + ' - ' + door_id )
Congratulations, your program is vulnerable to length-extension attack [0].What you want is something secret determining the output of something public... so instead of reinventing the wheel (the number 1 source of issues in crypto), use the standard, ie HMAC [1]. Now for the rest of the algorithm, IANAC, but truncating sounds like a bad idea. [0] https://en.wikipedia.org/wiki/Length_extension_attack [1] https://en.wikipedia.org/wiki/HMAC |
|
The op makes no broad claims. I think your insights are helpful, but I would change your wording from "Congratulations" to "unfortunately" and then politely point out how to resolve the issue.