@Override public String toString() { return "[Ed25519FieldElement val="+Utils.bytesToHex(toByteArray())+"]"; } }
@Test public void bytesToHexReturnsCorrectHexString() { Assert.assertThat(Utils.bytesToHex(bytes1), IsEqual.equalTo(hex1)); Assert.assertThat(Utils.bytesToHex(bytes2), IsEqual.equalTo(hex2)); Assert.assertThat(Utils.bytesToHex(bytes3), IsEqual.equalTo(hex3)); } }
@Override public String toString() { return "[Ed25519FieldElement val="+Utils.bytesToHex(toByteArray())+"]"; } }
/** * Use this method once to generated an "authToken" which is the * combination of a random "user" and the hash of an EdDSA-key. * Persist the authToken somewhere, either in a static final, inside a property etc. * * @return An authToken to be used with the constructor of AirPlayAuth. */ public static String generateNewAuthToken() { String clientId = AuthUtils.randomString(16); return clientId + "@" + net.i2p.crypto.eddsa.Utils.bytesToHex(new KeyPairGenerator().generateKeyPair().getPrivate().getEncoded()); }
private static String deriveEd25519PrivateKey(final String seed, final int... indexes) { try { return Utils.bytesToHex(SLIP10.deriveEd25519PrivateKey(Utils.hexToBytes(seed), indexes)); } catch (Exception e) { throw new RuntimeException(e); } } }