Also: it's 2016. Why is this using PBKDF2? If PBKDF2 is what you've got and you're protecting a website, that's fine, but this is a password manager.
Is the "commercial" version of this also Ruby code wrapping OpenSSL?
Also: it's 2016. Why is this using PBKDF2? If PBKDF2 is what you've got and you're protecting a website, that's fine, but this is a password manager.
Is the "commercial" version of this also Ruby code wrapping OpenSSL?
It is not the algorithm only but if you can look a little bit more closely, it is iteration count too. It uses 1.000 times and 10.000 times more iterations respectively.
Plus, depending on complexity, character set range enlarges.
>> Why is this using PBKDF2?
We would like to use more industry-standart way of things rather than individual works.
>> Is the "commercial" version of this also Ruby code wrapping OpenSSL?
Commercial version is purely written C version of it and backed up with OpenSSL on some cases.
Why do simpler passwords get a different construction? What does password complexity have to do with KDF hardness?
A password with lower levels of string complexity might make sense --- 1Password's strong passwords can sometimes be rejected by crappy websites. A password that sacrifices cryptographic strength in order to save a few tens of milliseconds of KDF, though, makes no sense at all.
Also: really, you should not be using PBKDF2.
Or if your attack model allows that reading protected files off a user's device is less likely than the cloud-synced database being compromised, you might derive the master encryption key as KDF_fast(KDF_slow(password)+password)), where KDF_slow takes 5 minutes and is stored on disk, but KDF_cheap takes 5 seconds.
Fortunately, Colin Percival came up with a much better solution in scrypt. It's a nice default if you want something battle-tested for a long time. Nobody should be using SHA-1, etc with solutions like scrypt available.