Program: 175643
Project: 175643
Buggy source:
/** 
 * Derive a key using Argon2id password hashing scheme <p> The following is taken from <a href="https://download.libsodium.org/doc/password_hashing/">libsodium documentation</a>: <blockquote> Argon2 is optimized for the x86 architecture and exploits the cache and memory organization of the recent Intel  and AMD processors. But its implementation remains portable and fast on other architectures. Argon2 has three  variants: Argon2d, Argon2i and Argon2id. Argon2i uses data-independent memory access, which is preferred for  password hashing and password-based key derivation. Argon2i also makes multiple passes over the memory to  protect from tradeoff attacks. Argon2id combines both. </blockquote>
 * @param passwd Array of bytes of password
 * @param salt Salt to use in key generation. The salt should be unpredictable and can be generated by calling SodiumLibary.randomBytes(int)The salt should be saved by the caller as it will be needed to derive the key again from the  password.
 * @return Generated key as an array of bytes
 * @throws SodiumLibraryException if libsodium's crypto_pwhash() does not return 0<code>crypto_pwhash()</code> in <a href="https://download.libsodium.org/doc/password_hashing/">Password hashing</a> libsodium page. <a href="https://github.com/P-H-C/phc-winner-argon2/raw/master/argon2-specs.pdf">Argon2i v1.3 Algorithm</a>.  <h3>Example</h3> <pre> <code> String password = "This is a Secret"; salt = SodiumLibary.randomBytes(sodium().crypto_pwhash_saltbytes()); byte[] key = SodiumLibary.cryptoPwhashArgon2i(password.getBytes(),salt); String keyHex = SodiumUtils.bin2hex(key); </code> </pre>
 */
public static byte[] cryptoPwhashArgon2i(byte[] passwd,byte[] salt) throws SodiumLibraryException {
  int saltLength=cryptoPwhashSaltBytes();
  if (salt.length != saltLength) {
    throw new SodiumLibraryException("String_Node_Str" + salt.length + "String_Node_Str"+ saltLength+ "String_Node_Str");
  }
  byte[] key=new byte[(int)sodium().crypto_box_seedbytes()];
  logger.info("String_Node_Str" + NativeLong.SIZE * 8 + "String_Node_Str");
  logger.info("String_Node_Str" + sodium().crypto_pwhash_opslimit_interactive());
  logger.info("String_Node_Str" + sodium().crypto_pwhash_memlimit_interactive());
  logger.info("String_Node_Str" + sodium().crypto_pwhash_alg_argon2id13());
  int rc=sodium().crypto_pwhash(key,key.length,passwd,passwd.length,salt,sodium().crypto_pwhash_opslimit_interactive(),sodium().crypto_pwhash_memlimit_interactive(),sodium().crypto_pwhash_alg_argon2id13());
  logger.info("String_Node_Str" + rc);
  if (rc != 0) {
    throw new SodiumLibraryException("String_Node_Str" + rc + "String_Node_Str");
  }
  return key;
}

Fixed version (ground truth):
/** 
 * Derive a key using Argon2id password hashing scheme <p> The following is taken from <a href="https://download.libsodium.org/doc/password_hashing/">libsodium documentation</a>: <blockquote> Argon2 is optimized for the x86 architecture and exploits the cache and memory organization of the recent Intel  and AMD processors. But its implementation remains portable and fast on other architectures. Argon2 has three  variants: Argon2d, Argon2i and Argon2id. Argon2i uses data-independent memory access, which is preferred for  password hashing and password-based key derivation. Argon2i also makes multiple passes over the memory to  protect from tradeoff attacks. Argon2id combines both. </blockquote>
 * @param passwd Array of bytes of password
 * @param salt Salt to use in key generation. The salt should be unpredictable and can be generated by calling SodiumLibary.randomBytes(int)The salt should be saved by the caller as it will be needed to derive the key again from the  password.
 * @return Generated key as an array of bytes
 * @throws SodiumLibraryException if libsodium's crypto_pwhash() does not return 0<code>crypto_pwhash()</code> in <a href="https://download.libsodium.org/doc/password_hashing/">Password hashing</a> libsodium page. <a href="https://github.com/P-H-C/phc-winner-argon2/raw/master/argon2-specs.pdf">Argon2i v1.3 Algorithm</a>.  <h3>Example</h3> <pre> <code> String password = "This is a Secret"; salt = SodiumLibary.randomBytes(sodium().crypto_pwhash_saltbytes()); byte[] key = SodiumLibary.cryptoPwhashArgon2i(password.getBytes(),salt); String keyHex = SodiumUtils.bin2hex(key); </code> </pre>
 */
public static byte[] cryptoPwhashArgon2i(byte[] passwd,byte[] salt) throws SodiumLibraryException {
  int saltLength=cryptoPwhashSaltBytes();
  if (salt.length != saltLength) {
    throw new SodiumLibraryException("String_Node_Str" + salt.length + "String_Node_Str"+ saltLength+ "String_Node_Str");
  }
  byte[] key=new byte[sodium().crypto_box_seedbytes().intValue()];
  logger.info("String_Node_Str" + NativeLong.SIZE * 8 + "String_Node_Str");
  logger.info("String_Node_Str" + sodium().crypto_pwhash_opslimit_interactive());
  logger.info("String_Node_Str" + sodium().crypto_pwhash_memlimit_interactive());
  logger.info("String_Node_Str" + sodium().crypto_pwhash_alg_argon2id13());
  int rc=sodium().crypto_pwhash(key,key.length,passwd,passwd.length,salt,sodium().crypto_pwhash_opslimit_interactive(),sodium().crypto_pwhash_memlimit_interactive(),sodium().crypto_pwhash_alg_argon2id13());
  logger.info("String_Node_Str" + rc);
  if (rc != 0) {
    throw new SodiumLibraryException("String_Node_Str" + rc + "String_Node_Str");
  }
  return key;
}