本文整理汇总了Java中org.bouncycastle.jcajce.provider.digest.SHA3类的典型用法代码示例。如果您正苦于以下问题:Java SHA3类的具体用法?Java SHA3怎么用?Java SHA3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SHA3类属于org.bouncycastle.jcajce.provider.digest包,在下文中一共展示了SHA3类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.bouncycastle.jcajce.provider.digest.SHA3; //导入依赖的package包/类
public static void main(String[] args) throws UnsupportedEncodingException {
String pass = "Hello我是王小明";
System.out.println(pass);
DigestSHA3 sha3256 = new SHA3.Digest256();
sha3256.update(pass.getBytes("UTF-8"));
System.out.println(Hex.toHexString(sha3256.digest()));
Digest sha256 = new SHA256.Digest();
sha256.update(pass.getBytes("UTF-8"));
byte[] d = sha256.digest();
System.out.println(Hex.toHexString(d));
sha256.reset();
sha256.update(d);
System.out.println(Hex.toHexString(sha256.digest()));
sha3256.reset();
sha3256.update(d);
System.out.println(Hex.toHexString(sha3256.digest()));
}
开发者ID:y12studio,项目名称:bkbc-premature,代码行数:21,代码来源:Sha3Foo.java
示例2: testDigest
import org.bouncycastle.jcajce.provider.digest.SHA3; //导入依赖的package包/类
public void testDigest()
throws Exception
{
evilNoConstructionTest(GOST3411.class);
evilNoConstructionTest(MD2.class);
evilNoConstructionTest(MD4.class);
evilNoConstructionTest(MD5.class);
evilNoConstructionTest(RIPEMD128.class);
evilNoConstructionTest(RIPEMD160.class);
evilNoConstructionTest(RIPEMD256.class);
evilNoConstructionTest(RIPEMD320.class);
evilNoConstructionTest(SHA1.class);
evilNoConstructionTest(SHA224.class);
evilNoConstructionTest(SHA256.class);
evilNoConstructionTest(SHA384.class);
evilNoConstructionTest(SHA3.class);
evilNoConstructionTest(SHA512.class);
evilNoConstructionTest(SM3.class);
evilNoConstructionTest(Tiger.class);
evilNoConstructionTest(Whirlpool.class);
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:22,代码来源:PrivateConstructorTest.java
示例3: sha3
import org.bouncycastle.jcajce.provider.digest.SHA3; //导入依赖的package包/类
/**
* Applies SHA-3 hash function on the {@code input} string
*
* @param input the string to apply to SHA-3 hash on
* @return the hashed input string
*/
public String sha3(String input) {
String hash = "";
try {
SHA3.DigestSHA3 md = new SHA3.DigestSHA3(256);
md.update(input.getBytes("UTF-8"));
hash = Hex.toHexString(md.digest());
} catch (UnsupportedEncodingException e) {
logger.error("Error while hashing with SHA-3", e);
}
return hash;
}
开发者ID:intellimate,项目名称:Izou,代码行数:19,代码来源:SecurityFunctions.java
示例4: computeSHA3
import org.bouncycastle.jcajce.provider.digest.SHA3; //导入依赖的package包/类
/**
* @deprecated This method results in erratic behavior or deadlock (with large files > 2GB).
* @param inputStream
* indicating the file path
* @throws IOException
* @see br.unb.cic.bionimbus.security#computeNativeSHA3(String)
*/
@Deprecated
public static String computeSHA3(final InputStream inputStream) throws IOException {
final long now = System.currentTimeMillis();
final byte[] dataBytes = new byte[KEY_SIZE];
final SHA3.DigestSHA3 digester = new SHA3.DigestSHA3(KEY_SIZE);
int nread = 0;
while ((nread = inputStream.read(dataBytes)) != -1) {
digester.update(dataBytes, 0, nread);
}
final byte[] mdbytes = digester.digest();
LOGGER.info(String.format("HASH time: %d", System.currentTimeMillis() - now));
// Convert the byte to hex format
return Hex.encodeHex(mdbytes);
}
开发者ID:bionimbuz,项目名称:Bionimbuz,代码行数:22,代码来源:HashUtil.java
示例5: setChecksumSHA3
import org.bouncycastle.jcajce.provider.digest.SHA3; //导入依赖的package包/类
private byte[] setChecksumSHA3(Path path) throws IOException, DigestException, NoSuchAlgorithmException {
return new SHA3.Digest512().digest(Files.readAllBytes(path));
}
开发者ID:MrChebik,项目名称:OSPicture,代码行数:4,代码来源:ChecksumUtils.java
示例6: digest
import org.bouncycastle.jcajce.provider.digest.SHA3; //导入依赖的package包/类
static String digest(final String input) {
final SHA3.DigestSHA3 sha3 = new SHA3.Digest256();
sha3.update(input.getBytes());
return hashToString(sha3);
}
开发者ID:mgrand,项目名称:bigchaindb-java-driver,代码行数:8,代码来源:Sha3_256Digest.java
注:本文中的org.bouncycastle.jcajce.provider.digest.SHA3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论