3
$\begingroup$

$2y$05$68LWs2pXiEvhVTacJ9PX/elfa1zq9jCBlv61hEw1pCvAHlaJyeMwW

This hash value is 70 characters long. How can I tell what type of encoding was used to generate it? Also, how many bits does each character hold?

$\endgroup$
5
$\begingroup$

That looks like bcrypt.

There are four parts:

  • $2y - identifier that this is bcrypt in modular crypt format.
  • $05 - number of key expansion rounds: in this case, it is 25

  • 68LWs...X/e - this is the salt. A total of 128 bits encoded in base64.

  • lfa1z...MwW - this is the hash. A total of 184 bits encoded in base64.

Since base64 encodes three bytes to four base64 characters, you get 6 bits for each base64 character.

$\endgroup$
  • 1
    $\begingroup$ +1, but three bytes encode to four characters (3*8/6) not six. $\endgroup$ – Rup Sep 25 '17 at 2:30
  • $\begingroup$ @Rup Oh right! I was probably thinking six bits! $\endgroup$ – Zizouz212 Sep 25 '17 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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