/** * Calculates the MD5 digest and returns the value as a 32 character hex string. * * @param data Data to digest * @return MD5 digest as a hex string */ public static String md5Hex(String data) { return Hex.encode(md5(data)); }
/** * Calculates the MD5 digest and returns the value as a 32 character hex string. * * @param data Data to digest * @return MD5 digest as a hex string */ public static String md5Hex(byte[] data) { return Hex.encode(md5(data)); }
/** * Calculates the SHA-1 digest and returns the value as a hex string. * * @param data Data to digest * @return SHA-1 digest as a hex string */ public static String shaHex(byte[] data) { return Hex.encode(sha(data)); }
/** * Calculates the SHA-1 digest and returns the value as a hex string. * * @param data Data to digest * @return SHA-1 digest as a hex string */ public static String shaHex(String data) { return Hex.encode(sha(data)); }
/** * Calculates the MD5 digest and returns the value as a 32 character hex string. * * @param data Data to digest * @return MD5 digest as a hex string * @throws IOException On error reading from the stream * @since 1.4 */ public static String md5Hex(InputStream data) throws IOException { return Hex.encode(md5(data)); }
/** * Calculates the SHA-1 digest and returns the value as a hex string. * * @param data Data to digest * @return SHA-1 digest as a hex string * @throws IOException On error reading from the stream * @since 1.4 */ public static String shaHex(InputStream data) throws IOException { return Hex.encode(sha(data)); }
/** * Calculates the SHA-256 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-256 digest as a hex string * @since 1.4 */ public static String sha256Hex(byte[] data) { return Hex.encode(sha256(data)); }
/** * Calculates the SHA-256 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-256 digest as a hex string * @since 1.4 */ public static String sha256Hex(String data) { return Hex.encode(sha256(data)); }
/** * Calculates the SHA-512 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-512 digest as a hex string * @since 1.4 */ public static String sha512Hex(byte[] data) { return Hex.encode(sha512(data)); }
private String encode(String rawPassword, byte[] salt) { byte[] digest = digest(rawPassword, salt); return new String(Hex.encode(digest)); }
/** * Calculates the SHA-384 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-384 digest as a hex string * @since 1.4 */ public static String sha384Hex(byte[] data) { return Hex.encode(sha384(data)); }
/** * Calculates the SHA-384 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-384 digest as a hex string * @since 1.4 */ public static String sha384Hex(String data) { return Hex.encode(sha384(data)); }
/** * Calculates the SHA-512 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-512 digest as a hex string * @since 1.4 */ public static String sha512Hex(String data) { return Hex.encode(sha512(data)); }
/** * Calculates the SHA-384 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-384 digest as a hex string * @throws IOException On error reading from the stream * @since 1.4 */ public static String sha384Hex(InputStream data) throws IOException { return Hex.encode(sha384(data)); }
/** * Calculates the SHA-512 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-512 digest as a hex string * @throws IOException On error reading from the stream * @since 1.4 */ public static String sha512Hex(InputStream data) throws IOException { return Hex.encode(sha512(data)); }
public static String hexHmac256(byte[] secret, String data) { return Hex.encode(hmac256(secret, data)); }
/** * Calculates the SHA-256 digest and returns the value as a hex string. * <p> * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0. * </p> * * @param data Data to digest * @return SHA-256 digest as a hex string * @throws IOException On error reading from the stream * @since 1.4 */ public static String sha256Hex(InputStream data) throws IOException { return Hex.encode(sha256(data)); }