title: How to implement Scrypt in Java?
body: <p>I have really been struggling trying to get Bouncy Castle Scrypt going in my web app for password encryption. I am fairly new to programming in Java and security.</p>
  
  <p>I have tried looking at Bouncy Castle's <a href="https://www.bouncycastle.org/docs/docs1.5on/org/bouncycastle/crypto/generators/SCrypt.html" rel="nofollow noreferrer">documentation for their Scrypt class</a>. However, I have a really hard time trying to figure out how it works. It doesn't seem to really give much information as to how to create the class or anything like that.</p>
  
  <p>I searched around Stack Exchange and Google to see if there is anywhere that could give me a good example as to what I should do to create this class. I found <a href="https://stackoverflow.com/questions/22226867/bouncy-castle-scrypt-implementation/41992593#41992593">this question and answer</a>, and I tried it out without creating a class, but that didn't seem to work either.</p>
  
  <p>To top this off, my import doesn't seem to want to work either.</p>
  
  <p>This is all of the code that I have:</p>
  
  <pre><code>import org.bouncycastle.crypto.generators;
  
  public class SCrypt extends java.lang.Object {
  
      public Scrypt(){}
  
      public static byte[] generate(byte[] P,byte[] S,int N,int r,int p,int dkLen) {
  
      }
  }
  </code></pre>
  
  <p>I want to use Scrypt since it seems to be the most secure in encrypting passwords, but it seems next impossible to implement. I'm really close with just going with a PBKDF2 since there is more documentation on it, but I'm hoping that there is someone out there who can help me get this going.</p>