org.mindrot.jbcrypt.BCrypt.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.mindrot.jbcrypt.BCrypt.<init>()方法的一些代码示例,展示了BCrypt.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BCrypt.<init>()方法的具体详情如下:
包路径:org.mindrot.jbcrypt.BCrypt
类名称:BCrypt
方法名:<init>

BCrypt.<init>介绍

暂无

代码示例

代码示例来源:origin: hierynomus/sshj

private void initializeCipher(String kdfName, byte[] kdfOptions, Cipher cipher) throws Buffer.BufferException {
  if (kdfName.equals(BCRYPT)) {
    PlainBuffer opts = new PlainBuffer(kdfOptions);
    byte[] passphrase = new byte[0];
    if (pwdf != null) {
      CharBuffer charBuffer = CharBuffer.wrap(pwdf.reqPassword(null));
      ByteBuffer byteBuffer = Charset.forName("UTF-8").encode(charBuffer);
      passphrase = Arrays.copyOfRange(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit());
    }
    byte[] keyiv = new byte[48];
    new BCrypt().pbkdf(passphrase, opts.readBytes(), opts.readUInt32AsInt(), keyiv);
    byte[] key = Arrays.copyOfRange(keyiv, 0, 32);
    byte[] iv = Arrays.copyOfRange(keyiv, 32, 48);
    cipher.init(Cipher.Mode.Decrypt, key, iv);
  } else {
    throw new IllegalStateException("No support for KDF '" + kdfName + "'.");
  }
}

代码示例来源:origin: hierynomus/sshj

B = new BCrypt();
hashed = B.crypt_raw(passwordb, saltb, rounds,
    (int[])bf_crypt_ciphertext.clone());

代码示例来源:origin: hierynomus/sshj

public void testBCryptPbkdfTestVectors() throws Exception {
    System.out.print("BCrypt.pbkdf w/ known vectors: ");
    for (BCryptPbkdfTV tv : bcrypt_pbkdf_test_vectors) {
      byte[] output = new byte[tv.out.length];
      new BCrypt().pbkdf(tv.pass, tv.salt, tv.rounds, output);
      assertEquals(Arrays.toString(tv.out), Arrays.toString(output));
      System.out.print(".");
    }
    System.out.println("");
  }
}

代码示例来源:origin: hierynomus/sshj

public void testBCryptHashTestVectors() throws Exception {
  System.out.print("BCrypt.hash w/ known vectors: ");
  for (BCryptHashTV tv : bcrypt_hash_test_vectors) {
    byte[] output = new byte[tv.out.length];
    new BCrypt().hash(tv.pass, tv.salt, output);
    assertEquals(Arrays.toString(tv.out), Arrays.toString(output));
    System.out.print(".");
  }
  System.out.println("");
}

代码示例来源:origin: jenkinsci/trilead-ssh2

private static byte[] generateKayAndIvPbkdf2(byte[] password, byte[] salt, int rounds, int keyLength, int ivLength) {
  byte[] keyAndIV = new byte[keyLength + ivLength];
  new BCrypt().pbkdf(password, salt, rounds, keyAndIV);
  return keyAndIV;
}

代码示例来源:origin: rogerta/secrets-for-android

int plaintext[] = {0x155cbf8e, 0x57f57513, 0x3da787b9, 0x71679d82,
          0x7cf72e93, 0x1ae25274, 0x64b54adc, 0x335cbd0b};
BCrypt bcrypt = new BCrypt();
byte[] rawBytes = bcrypt.crypt_raw(password.getBytes(
  StandardCharsets.UTF_8), salt,

代码示例来源:origin: com.hierynomus/sshj

private void initializeCipher(String kdfName, byte[] kdfOptions, Cipher cipher) throws Buffer.BufferException {
  if (kdfName.equals(BCRYPT)) {
    PlainBuffer opts = new PlainBuffer(kdfOptions);
    byte[] passphrase = new byte[0];
    if (pwdf != null) {
      CharBuffer charBuffer = CharBuffer.wrap(pwdf.reqPassword(null));
      ByteBuffer byteBuffer = Charset.forName("UTF-8").encode(charBuffer);
      passphrase = Arrays.copyOfRange(byteBuffer.array(), byteBuffer.position(), byteBuffer.limit());
    }
    byte[] keyiv = new byte[48];
    new BCrypt().pbkdf(passphrase, opts.readBytes(), opts.readUInt32AsInt(), keyiv);
    byte[] key = Arrays.copyOfRange(keyiv, 0, 32);
    byte[] iv = Arrays.copyOfRange(keyiv, 32, 48);
    cipher.init(Cipher.Mode.Decrypt, key, iv);
  } else {
    throw new IllegalStateException("No support for KDF '" + kdfName + "'.");
  }
}

代码示例来源:origin: rogerta/secrets-for-android

B = new BCrypt();
hashed = B.crypt_raw(passwordb, saltb, rounds,
    (int[])bf_crypt_ciphertext.clone());

代码示例来源:origin: org.connectbot.jbcrypt/jbcrypt

B = new BCrypt();
hashed = B.crypt_raw(passwordb, saltb, rounds,
  (int[])bf_crypt_ciphertext.clone());

代码示例来源:origin: org.mindrot/jbcrypt

B = new BCrypt();
hashed = B.crypt_raw(passwordb, saltb, rounds,
  (int[])bf_crypt_ciphertext.clone());

代码示例来源:origin: com.hierynomus/sshj

B = new BCrypt();
hashed = B.crypt_raw(passwordb, saltb, rounds,
    (int[])bf_crypt_ciphertext.clone());

代码示例来源:origin: de.svenkubiak/jBCrypt

B = new BCrypt();
hashed = B.crypt_raw(passwordb, saltb, rounds,
  (int[])bf_crypt_ciphertext.clone());

代码示例来源:origin: rogerta/secrets-for-android

0x7cf72e93, 0x1ae25274, 0x64b54adc, 0x335cbd0b};
final byte[] password = {1, 2, 3, 4, 5, 6, 7, 8};
BCrypt bcrypt = new BCrypt();

代码示例来源:origin: actframework/actframework

B = new BCrypt();
hashed = B.crypt_raw(passwordb, saltb, rounds,
    (int[])bf_crypt_ciphertext.clone());

代码示例来源:origin: org.actframework/act

B = new BCrypt();
hashed = B.crypt_raw(passwordb, saltb, rounds,
    (int[])bf_crypt_ciphertext.clone());

代码示例来源:origin: rogerta/secrets-for-android

BCrypt bcrypt = new BCrypt();
byte[] rawBytes = bcrypt.crypt_raw(password.getBytes(
  StandardCharsets.UTF_8),

相关文章