@Test @Parameters({ "input, 140f86aae51ab9e1cda9b4254fe98a74eb54c1a1", "test, a94a8fe5ccb19ba61c4c0873d391e987982fbbd3", "this is a much longer test, 30462670fe8243b215e2cf9ff14160811284832d" }) public void test_sha1(final String input, final String expectedOutput) { final String output = Sha1Tools.sha1(input); assertEquals(expectedOutput, output); }
public static String sha1(final String input) { try { final MessageDigest crypt = MessageDigest.getInstance("SHA-1"); crypt.reset(); crypt.update(input.getBytes("UTF-8")); return byteToHex(crypt.digest()); } catch (final NoSuchAlgorithmException | UnsupportedEncodingException exception) { throw new RuntimeException(exception.getMessage(), exception); } }
Sha1Tools { public static String sha1(final String input) { try { final MessageDigest crypt = MessageDigest.getInstance("SHA-1"); crypt.reset(); crypt.update(input.getBytes("UTF-8")); return byteToHex(crypt.digest()); } catch (final NoSuchAlgorithmException | UnsupportedEncodingException exception) { throw new RuntimeException(exception.getMessage(), exception); } } }
Sha1Tools { public static String sha1(final String input) { try { final MessageDigest crypt = MessageDigest.getInstance("SHA-1"); crypt.reset(); crypt.update(input.getBytes("UTF-8")); return byteToHex(crypt.digest()); } catch (final NoSuchAlgorithmException | UnsupportedEncodingException exception) { throw new RuntimeException(exception.getMessage(), exception); } }  }
Sha1Tools { public static String sha1(final String input) { try { final MessageDigest crypt = MessageDigest.getInstance("SHA-1"); crypt.reset(); crypt.update(input.getBytes("UTF-8")); return byteToHex(crypt.digest()); } catch (final NoSuchAlgorithmException | UnsupportedEncodingException exception) { throw new RuntimeException(exception.getMessage(), exception); } }  static String sha1(final String input); }
Sha1Tools { public static String sha1(final String input) { try { final MessageDigest crypt = MessageDigest.getInstance("SHA-1"); crypt.reset(); crypt.update(input.getBytes("UTF-8")); return byteToHex(crypt.digest()); } catch (final NoSuchAlgorithmException | UnsupportedEncodingException exception) { throw new RuntimeException(exception.getMessage(), exception); } }  static String sha1(final String input);  }