@Test public void should_compute_hash_for_mail(){ assertThat(HashUtil.md5Hex("gui.ehret@gmail.com")).isEqualTo("aa4d47d1016e45c23b6af05ec11c0a9c"); }
public static String md5Hex (String message) { if(message==null){ return null; } try { MessageDigest md = MessageDigest.getInstance("MD5"); return hex (md.digest(message.getBytes("CP1252"))); } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { logger.warn("Error on hash compute for mail " + message); } return null; }
HashUtil { public static String md5Hex (String message) { if(message==null){ return null; } try { MessageDigest md = MessageDigest.getInstance("MD5"); return hex (md.digest(message.getBytes("CP1252"))); } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { logger.warn("Error on hash compute for mail " + message); } return null; } }
HashUtil { public static String md5Hex (String message) { if(message==null){ return null; } try { MessageDigest md = MessageDigest.getInstance("MD5"); return hex (md.digest(message.getBytes("CP1252"))); } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { logger.warn("Error on hash compute for mail " + message); } return null; }  }
HashUtil { public static String md5Hex (String message) { if(message==null){ return null; } try { MessageDigest md = MessageDigest.getInstance("MD5"); return hex (md.digest(message.getBytes("CP1252"))); } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { logger.warn("Error on hash compute for mail " + message); } return null; }  static String md5Hex(String message); }
HashUtil { public static String md5Hex (String message) { if(message==null){ return null; } try { MessageDigest md = MessageDigest.getInstance("MD5"); return hex (md.digest(message.getBytes("CP1252"))); } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { logger.warn("Error on hash compute for mail " + message); } return null; }  static String md5Hex(String message);  }