本文整理了Java中org.spongycastle.crypto.digests.SHA256Digest.doFinal()
方法的一些代码示例,展示了SHA256Digest.doFinal()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SHA256Digest.doFinal()
方法的具体详情如下:
包路径:org.spongycastle.crypto.digests.SHA256Digest
类名称:SHA256Digest
方法名:doFinal
暂无
代码示例来源:origin: QuincySx/BlockchainWallet-Crypto
public static byte[] sha256(byte[] bytes, int offset, int size) {
SHA256Digest sha256Digest = new SHA256Digest();
sha256Digest.update(bytes, offset, size);
byte[] sha256 = new byte[32];
sha256Digest.doFinal(sha256, 0);
return sha256;
}
代码示例来源:origin: com.madgag.spongycastle/core
private static BigInteger deriveSessionKey(BigInteger keyingMaterial)
{
/*
* You should use a secure key derivation function (KDF) to derive the session key.
*
* For the purposes of this example, I'm just going to use a hash of the keying material.
*/
SHA256Digest digest = new SHA256Digest();
byte[] keyByteArray = keyingMaterial.toByteArray();
byte[] output = new byte[digest.getDigestSize()];
digest.update(keyByteArray, 0, keyByteArray.length);
digest.doFinal(output, 0);
return new BigInteger(output);
}
}
代码示例来源:origin: telehash/telehash-java
/**
* Return a SHA-256 digest of the provided byte buffer.
*
* @param buffer The buffer to digest.
* @return A 32-byte array representing the digest.
*/
@Override
public byte[] sha256Digest(byte[] buffer) {
SHA256Digest digest = new SHA256Digest();
digest.update(buffer, 0, buffer.length);
byte[] output = new byte[256/8];
digest.doFinal(output, 0);
return output;
}
内容来源于网络,如有侵权,请联系作者删除!