code: public static String scrypt(String passwd, int N, int r, int p) {
          try {
              byte[] salt = new byte[16];
              SecureRandom.getInstance("SHA1PRNG").nextBytes(salt);
  
              byte[] derived = SCrypt.scrypt(passwd.getBytes("UTF-8"), salt, N, r, p, 32);
  
              String params = Long.toString(log2(N) << 16L | r << 8 | p, 16);
  
              StringBuilder sb = new StringBuilder((salt.length + derived.length) * 2);
              sb.append("$s0$").append(params).append('$');
              sb.append(encode(salt)).append('$');
              sb.append(encode(derived));
  
              return sb.toString();
          } catch (UnsupportedEncodingException e) {
              throw new IllegalStateException("JVM doesn't support UTF-8?");
          } catch (GeneralSecurityException e) {
              throw new IllegalStateException("JVM doesn't support SHA1PRNG or HMAC_SHA256?");
          }
      }
docs: Hash the supplied plaintext password and generate output in the format described
  in {@link SCryptUtil}.
  
  @param passwd    Password.
  @param N         CPU cost parameter.
  @param r         Memory cost parameter.
  @param p         Parallelization parameter.
  
  @return The hashed password.