Store hashed passwords postgresql

I am trying to store hashed passwords in a postgresql database. In my databaserecord and in the database itself, I defined the column as string but it does not get stored. When I suppress this column, the rest of the databaserecord gets stored. Is there any particular data type to be used to store hashed passwords in Postgresql?

Use VarChar or Text, but either EncodeHex or EncodeBase64 before storing the hashed value.


Also, PGSQL has a CITEXT extension you can turn on that is great for columns like this. CI for case-insensitive, it basically just does the LOWER(column) = LOWER(value) for you, but it’s convenient nonetheless.

In this case, that would only be convenient if hex-encoded. It might create issues with Base64 since the encoding itself is case-sensitive.

That’s true.