/** * Creates SHA-256 digest of a file. * * @param file {@link File} to create digest of. * @return SHA-256 digest of the {@link File}. */ public static String sha256(final File file) throws IOException { return DigestEngine.sha256().digestString(file); }
/** * Creates MD5 digest of a {@link File}. * * @param file {@link File} to create digest of. * @return MD5 digest of the {@link File}. */ public static String md5(final File file) throws IOException { return DigestEngine.md5().digestString(file); }
/** * Creates SHA-512 digest of a file. * * @param file {@link File} to create digest of. * @return SHA-512 digest of the {@link File}. */ public static String sha512(final File file) throws IOException { return DigestEngine.sha512().digestString(file); }
@Test void testMD5() { assertEquals("5513A194A0D3E46B8D90021B283BE791", DigestEngine.md5().digestString("Jodd")); } }
@Test void testSha256() { assertEquals("D5E94A2DD851E6E2A233EFA00CF26B385A933F26223B00757E189397F8B92530", DigestEngine.sha256().digestString("Jodd")); }
@Test void testSha512() { assertEquals("ACF65B0C3DE891B2984F461FA12EF4DD205B2DE360F3C834A47368CBDD334687AB5E8405AA910DF8AC6B5631BF1F2CC5133B0D95493A40452EC5B984E4FC31E8", DigestEngine.sha512().digestString("Jodd")); }
@Test void testSha1() { assertEquals("626B0566A836677FA85C6952417E704E727E336C", DigestEngine.sha1().digestString("Jodd")); }
/** * Creates SHA-256 digest of a file. * * @param file {@link File} to create digest of. * @return SHA-256 digest of the {@link File}. */ public static String sha256(final File file) throws IOException { return DigestEngine.sha256().digestString(file); }
/** * Creates MD5 digest of a {@link File}. * * @param file {@link File} to create digest of. * @return MD5 digest of the {@link File}. */ public static String md5(final File file) throws IOException { return DigestEngine.md5().digestString(file); }
/** * Creates SHA-512 digest of a file. * * @param file {@link File} to create digest of. * @return SHA-512 digest of the {@link File}. */ public static String sha512(final File file) throws IOException { return DigestEngine.sha512().digestString(file); }