Search code examples
javajavascriptbcryptcrypt

javascript brcrypt and java / jruby Bcrypt


I wanted to use Twin-bcrypt (a javascript lib) an the client side. On serverside I use Jruby / java in that case I use JBCrypt. The javascriptside is 2y salted the Javaside is 2a salted which seems to be buggy. Both are i my experience not compatible. (I just wonder why java which is used by enterprises has no up to date bcrypt). But is there any experience to hash a password with bcrypt with javascript on the clientside and compare it on the java serverside.


Solution

  • You might want to use jsBCrypt for javascript. This is based on JBCrypt and as expected works well with it.

    The snippet on jsBCrypt can help you get started with trying this. (note: JBCrypt has default 10 rounds).