Question

It seems that understanding what bcrypt is all about not clear for some people and as well as for me since I still keep reading SOF users' questions. I got an example here about how to use bcrypt hashing:How do you use bcrypt for hashing passwords in PHP

As I understand that bcrypt is one-way string, and if so that means I can use it for hashing only. There are some articles mention that bcrypt is also used for encrypting, which is none sense to me and that's because if I can encrypt a string that means I can decrypt it.

how the question is if bcrypt can be used for encryption, then how? can anyone give any example, please??

Thanks,

Was it helpful?

Solution

The bcrypt hashfunction/KDF is for hashing only.

blowfish, on which bcrypt is based is a block cipher i.e. it is used for encryption.

There is also an unrelated program called bcrypt, which uses blowfish based encryption.

Unfortunately many people use bcrypt and blowfish interchangeably, which leads to confusion.

OTHER TIPS

bcrypt() in php is a one way hashing function, so would not be suitable for two way encryption/decryption.

However there are packages availible called bcrypt which is not a PHP function which is just an implementation of the blowfish cipher which allows two way (encryption and decryption).

So bcrypt can do decryption however bcrypt() cannot

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top