"The only thing we store about you is your hashed IP address"
The IPv4 address namespace is so small that brute-forcing hashes would be trivial, so this isn't an effective approach.
The IPv4 address namespace is so small that brute-forcing hashes would be trivial, so this isn't an effective approach.
>>> timeit.timeit('bcrypt.generate_password_hash("127.0.0.1")', "from app import bcrypt", number=10)
3.342690944671631And yes, I know that 12 rounds of bcrypt doesn't mean much. It will delay brute force attacks, though.
Its not a 100% guarantee - but it's a start.
A better approach would be something quicker to compute but that you can destroy equally easily. Generate a random token that cycles every X minutes/hours. The HMAC the remote IP and this secret. Use the result for bans/rolling rate limiting. If you keep the token only in memory then you don't have to worry about the IP lists being leaked as they won't be recoverable.