3
$\begingroup$

I am looking at this in the context of password hashing in PostgreSQL, specifically, the crypt function of the pgcrypto extension.

The PostgreSQL documentation refers to the Unix man page of the crypt function. The man page (man 3 crypt) of the crypt function states that it performs Trapdoor encryption. Now a trapdoor function should

  1. Be easy to compute in one direction - this I understand.
  2. Be hard to compute in the other direction - this I also understand
  3. Be easy to compute in the other direction if one knows the 'trapdoor' value - I don't understand if/how one might be able to get this value.

I know how to generate a hash, but how might I be able to get the trapdoor value to compute back the original password? Or are the algorithms written in a way so as to discard the trapdoor value?

It did not make sense to ask this in the dba.stackexchange community, as that's primarily about database design and related topics.

Edit/update - Only the BSD man page for crypt states it is a Trapdoor function. The Linux man page states no such thing.

$\endgroup$

1 Answer 1

2
$\begingroup$

TLDR: crypt is not a trapdoor function.

crypt does not meet the question's condition 3. It does not apply a trapdoor function, which the question defines correctly at some level of detail. Whether crypt "performs Trapdoor encryption" depends on the definition given to this. I would not say that.

The cryptographic functions used by crypt nowadays are called [key-stretching | purposely slow] [password-based] hash. On top of this it's also memory-hard when it uses scrypt or Argon2.

$\endgroup$
1
  • $\begingroup$ Thanks. The BSD man page for crypt says Trapdoor in the description. On Ubuntu Linux, it only says passphrase hashing. $\endgroup$
    – ahron
    Commented Jan 16, 2023 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.