Using hashed password as key in key/value store

I have an application that needs to store some user information in a key/value store. I was thinking about using the user’s one-way encrypted password as the key, but the different methods I’ve tried all create a different hash each time I encrypt the password.

I originally thought about using bcrypt but I don’t want to have to CompareHashAndPassword() through every key to find a match.

Perhaps I’m approaching the problem from the wrong perspective, but is there a way to encrypt a password such that the resultant hash string will always be the same?

Thanks,

Rob

Maybe this will work, it seems to return the same string every time from the same password:

https://play.golang.org/p/3IHwa4ioJDv

Or is there a better way to do this?

Thanks,

Rob

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.