Search code examples
javabouncycastlescrypt

Does the Bouncy Castle SCrypt implementation include the factors in the result?


I'm pretty sure it doesn't, but I want to confirm whether the SCrypt implementation in Bouncy Castle for Java, SCrypt.generate(), includes the parameters in the result (like an implementation for NodeJS does).


Solution

  • No Bouncy castle does not include them in result, but if you want similar result you can use SpringFramework SCrypt.

    import org.bouncycastle.crypto.generators.SCrypt;
    public static void ScryptSpringFramework()
    {   
        public static String plaintextPassword  = "myname123456";
        SCryptPasswordEncoder sEncoder = new SCryptPasswordEncoder();
    
        String str1 = sEncoder.encode(plaintextPassword);
        System.out.println("SpringFramework output of "+plaintextPassword+" = "+str1);              
    }
    

    Here is the link for the SpringFramework crypto.