@Test void hashOfEmptyString() { assertEquals("da39a3ee", IdGenerator.generateIdUsingHash("")); }
public static String generateIdUsingHash(final String value) { MessageDigest converter; try { converter = MessageDigest.getInstance("SHA1"); String id = new String(Hex.encodeHex(converter.digest(value.getBytes()))); return id.substring(0, 8); } catch (final NoSuchAlgorithmException e) { LOGGER.info("Can't generate SHA1 hash code", e); throw new RuntimeException("Can't generate SHA1 hash code", e); } }
IdGenerator { public static String generateIdUsingHash(final String value) { MessageDigest converter; try { converter = MessageDigest.getInstance("SHA1"); String id = new String(Hex.encodeHex(converter.digest(value.getBytes()))); return id.substring(0, 8); } catch (final NoSuchAlgorithmException e) { LOGGER.info("Can't generate SHA1 hash code", e); throw new RuntimeException("Can't generate SHA1 hash code", e); } } }
IdGenerator { public static String generateIdUsingHash(final String value) { MessageDigest converter; try { converter = MessageDigest.getInstance("SHA1"); String id = new String(Hex.encodeHex(converter.digest(value.getBytes()))); return id.substring(0, 8); } catch (final NoSuchAlgorithmException e) { LOGGER.info("Can't generate SHA1 hash code", e); throw new RuntimeException("Can't generate SHA1 hash code", e); } }  }
IdGenerator { public static String generateIdUsingHash(final String value) { MessageDigest converter; try { converter = MessageDigest.getInstance("SHA1"); String id = new String(Hex.encodeHex(converter.digest(value.getBytes()))); return id.substring(0, 8); } catch (final NoSuchAlgorithmException e) { LOGGER.info("Can't generate SHA1 hash code", e); throw new RuntimeException("Can't generate SHA1 hash code", e); } }  static String generateRandomId(); static String generateIdUsingHash(final String value); }
IdGenerator { public static String generateIdUsingHash(final String value) { MessageDigest converter; try { converter = MessageDigest.getInstance("SHA1"); String id = new String(Hex.encodeHex(converter.digest(value.getBytes()))); return id.substring(0, 8); } catch (final NoSuchAlgorithmException e) { LOGGER.info("Can't generate SHA1 hash code", e); throw new RuntimeException("Can't generate SHA1 hash code", e); } }  static String generateRandomId(); static String generateIdUsingHash(final String value);  }