SHA1 { public static String getSHA1(String pArg) { String sha1 = ""; try { MessageDigest crypt = MessageDigest.getInstance("SHA-1"); crypt.reset(); crypt.update(pArg.getBytes("UTF-8")); sha1 = byteToHex(crypt.digest()); } catch (NoSuchAlgorithmException exp) { LOGGER.error(ERROR_WHILE_EXECUTING_SHA1 + exp); } catch (UnsupportedEncodingException exp) { LOGGER.error(ERROR_WHILE_EXECUTING_SHA1 + exp); } return sha1; }  static String getSHA1(String pArg);  }
@Test public void testgetSHA1() { Assert.assertEquals("Hashed value is not the expected one", "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684", SHA1.getSHA1("pass")); }