Search code examples
javascriptnode.jshashbcrypt

What is the length of bcrypt hash output?


In Javascript it is possible to create hash using the bcrypt library as follows:

const hashed = await bcrypt.hash('input', salt);

My question is what is the length of hashed?

My guess: Since it adds the salt to output, I guess the length of hashed should be something like:

length_hash = length(salt) + F(input)

However, I could not find a formula for F.

Why do I need it? I need to know what the maximum length will be in advance to set a max_length on the corresponding field in database.

Any help is highly appreciated.


Solution

  • It should be something related to the bcrypt algorithm not the library itself. Simple search led to this question