@Test public void simpleMd5() throws LookupException { DynamicHostnameGenerator generator = new DynamicHostnameGenerator("B-", "edelivery.tech.ec.europa.eu", "MD5"); assertEquals(generator.generate(ParticipantIdentifier.of("9908:difi")), "B-42fabff13df16391dbd1f01b7c05d0e7.iso6523-actorid-upis." + "edelivery.tech.ec.europa.eu"); assertEquals(generator.generate(ParticipantIdentifier.of("9908:DIFI")), "B-42fabff13df16391dbd1f01b7c05d0e7.iso6523-actorid-upis." + "edelivery.tech.ec.europa.eu"); }
public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); }
DynamicHostnameGenerator { public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } }
DynamicHostnameGenerator { public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm);  DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm, BaseEncoding encoding); }
DynamicHostnameGenerator { public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm);  DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm, BaseEncoding encoding); String generate(ParticipantIdentifier participantIdentifier); }
DynamicHostnameGenerator { public String generate(ParticipantIdentifier participantIdentifier) throws LookupException { String receiverHash; try { MessageDigest md = MessageDigest.getInstance(digestAlgorithm, BouncyCastleProvider.PROVIDER_NAME); byte[] digest = md.digest(participantIdentifier.getIdentifier().getBytes(StandardCharsets.UTF_8)); receiverHash = encoding.encode(digest).toLowerCase(); } catch (Exception e) { throw new LookupException(e.getMessage(), e); } return String.format("%s%s.%s.%s", prefix, receiverHash, participantIdentifier.getScheme().getIdentifier(), hostname); } DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm);  DynamicHostnameGenerator(String prefix, String hostname, String digestAlgorithm, BaseEncoding encoding); String generate(ParticipantIdentifier participantIdentifier);  }