0

I want to keep user records in Postgres database and faced one issue which block me. It is password encryption. For example, this is correcetly encrypted password 12345 via default Ubuntu crypt function: $6$P5jfk4Ufh33f$.Dc8H9jsWAl/igt4QPbYI/El28SyUEAoJPPHsLIGMKOymhC7AIaiizlW5W9hm7kU7PYMCySEhYtMqVPFsVTMK/

As I understand first 6 means that it is encrypted via sha384 (or sha256) algorithm. Ok, i created an extension pgcrypto in desired database, but following code: SELECT digest('12345', 'sha384') as pwhash; returns absolutely different result - without algorithm mark and salt: \x0fa76955abfa9dafd83facca8343a92aa09497f98101086611b0bfa95dbc0dcc661d62e9568a5a032ba81960f3e55d4a

I want to get exactly specified format because it is used by PAM to check user credetials and it does not understand password hashed another way.

Craig Ringer
  • 57,821
  • 6
  • 162
  • 193
Alex G.P.
  • 101
  • 1

0 Answers0