in reply to In 2022, my preferred method to securely store passwords is:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: In 2022, my preferred method to securely store passwords is:
by cavac (Prior) on Jan 10, 2022 at 15:59 UTC | |
rot13 also takes quite a lot of processing power, especially now that Unicode is a thing. Better just take the input as raw binary stream and xor it against a fixed value. You can write the whole thing in like a dozen or so assembly instructions. In the same loop you can compare your password to the expected one as well, no need for a wasteful second loop. It's been a few decades since i've done some assembly coding, but something like this should probably do it:
Edit: Ooops. By accidentally using the zero byte termination of the user input instead of the stored password, i seem to have recreated a rather classic exploit. In this, the user determines how many bytes are checked. If the user simply presses enter at the password prompt, the number of checked bytes is a staggering "none at all", which bypasses the check completely.
perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'
| [reply] [d/l] [select] |