@Test void differentIdsShouldGenerateDifferentKeys() { MasterKey masterKey = MasterKey.random(); Bytes subKey1 = masterKey.deriveKey(40, 1, "abcdefg"); assertEquals(subKey1, masterKey.deriveKey(40, 1, "abcdefg")); assertNotEquals(subKey1, masterKey.deriveKey(40, 2, "abcdefg")); assertNotEquals(subKey1, masterKey.deriveKey(40, 1, new byte[KeyDerivation.contextLength()])); }
public static int contextLength() { long contextbytes = Sodium.crypto_kdf_contextbytes(); if (contextbytes > Integer.MAX_VALUE) { throw new IllegalArgumentException("crypto_kdf_bytes_min: " + contextbytes + " is too large"); } return (int) contextbytes; }
KeyDerivation { public static int contextLength() { long contextbytes = Sodium.crypto_kdf_contextbytes(); if (contextbytes > Integer.MAX_VALUE) { throw new IllegalArgumentException("crypto_kdf_bytes_min: " + contextbytes + " is too large"); } return (int) contextbytes; } }
KeyDerivation { public static int contextLength() { long contextbytes = Sodium.crypto_kdf_contextbytes(); if (contextbytes > Integer.MAX_VALUE) { throw new IllegalArgumentException("crypto_kdf_bytes_min: " + contextbytes + " is too large"); } return (int) contextbytes; }  }
KeyDerivation { public static int contextLength() { long contextbytes = Sodium.crypto_kdf_contextbytes(); if (contextbytes > Integer.MAX_VALUE) { throw new IllegalArgumentException("crypto_kdf_bytes_min: " + contextbytes + " is too large"); } return (int) contextbytes; }  static boolean isAvailable(); static int contextLength(); static int minSubKeyLength(); static int maxSubKeyLength(); }
KeyDerivation { public static int contextLength() { long contextbytes = Sodium.crypto_kdf_contextbytes(); if (contextbytes > Integer.MAX_VALUE) { throw new IllegalArgumentException("crypto_kdf_bytes_min: " + contextbytes + " is too large"); } return (int) contextbytes; }  static boolean isAvailable(); static int contextLength(); static int minSubKeyLength(); static int maxSubKeyLength();  }