public class Hash { private Hash() { } /** * Keccak-256 hash function. * * @param hexInput hex encoded input data with optional 0x prefix * @return hash value as hex encoded string */ public static String sha3(String hexInput) { byte[] bytes = Numeric.hexStringToByteArray(hexInput); byte[] result = sha3(bytes); return Numeric.toHexString(result); } public static String sha3String(byte[] input) { return DigestUtils.sha256Hex(input); } /** * Keccak-256 hash function. * * @param input binary encoded input data * @param offset of start of data * @param length of data * @return hash value */ public static byte[] sha3(byte[] input, int offset, int length) { Keccak.DigestKeccak kecc = new Keccak.Digest256(); kecc.update(input, offset, length); return kecc.digest(); } /** * Keccak-256 hash function. * * @param input binary encoded input data * @return hash value */ public static byte[] sha3(byte[] input) { return sha3(input, 0, input.length); } /** * Keccak-256 hash function that operates on a UTF-8 encoded String. * * @param utf8String UTF-8 encoded string * @return hash value as hex encoded string */ public static String sha3String(String utf8String) { return Numeric.toHexString(sha3(utf8String.getBytes(StandardCharsets.UTF_8))); } /** * Generates SHA-256 digest for the given {@code input}. * * @param input The input to digest * @return The hash value for the given input * @throws RuntimeException If we couldn't find any SHA-256 provider */ public static byte[] sha256(byte[] input) { try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); return digest.digest(input); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Couldn't find a SHA-256 provider", e); } } }
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算