The "right" way to hash a password for storing in the database

So, you're storing a password in that database, huh?

So, given that password security is in the news quite a bit lately with all sorts of high-profile hacking incidents, I figured I'd write down a little code here that I've been considering.


Stupid security policies

In which I am asked by my employer to incriminate myself in future crimes in the office

I recently discovered that my employer wants ALL employees to swipe their badge in the elevator, even if another employee is present. In response, I came up with these scenarios (without even doing much thinking):