Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is roughly what it does. I did not bother to figure out what the purpose of the SHA256 hahses not mentioned here is. The code also converts between byte arrays and strings using ASCII and UTF-16 encoding and Base64 encoded data a thousand times so I might have lost track of this and the pseudo code below is missing some encoding changes.

  salt = "$2a$10$67C.GOM1jShOBOM.f.BIAe" // Version 2a and work factor 10.

  password = BASE64-ENCODE(BCRYPT(password1 + password2, salt))

  rounds = 45000

  salt = CSRNG.GetBytes(32)

  key + iv = PBKDF2-HMAC-SHA1(password, salt, rounds).GetBytes(32 + 16)

  encrypted = BASE64-ENCODE(salt + AES-256-CBC(GZIP(message), key, iv))
The bcrypt implementation comes from [1].

[1] http://bcrypt.codeplex.com/



I don't understand why this uses both bcrypt and PBKDF2.

The problem it tries to solve is turning a low-entropy passphrase into a 128 bit AES key. That's the problem that a KDF, like PBKDF2, solves.

If they want to make the system stronger, increase the PBKDF2 iterations; lose the bcrypt step. (They could also use a better KDF, like scrypt, instead of PBKDF2; PBKDF2 is fine, though).

Also, compressing breaks semantic security. Don't compress before encrypting.

Edited; briefly thought parent commenter was the author of the tool.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: