本文整理汇总了Java中org.bouncycastle.crypto.digests.SHA224Digest类的典型用法代码示例。如果您正苦于以下问题:Java SHA224Digest类的具体用法?Java SHA224Digest怎么用?Java SHA224Digest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SHA224Digest类属于org.bouncycastle.crypto.digests包,在下文中一共展示了SHA224Digest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHash
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static final Digest createHash(int hashAlgorithm)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest();
case HashAlgorithm.sha1:
return new SHA1Digest();
case HashAlgorithm.sha224:
return new SHA224Digest();
case HashAlgorithm.sha256:
return new SHA256Digest();
case HashAlgorithm.sha384:
return new SHA384Digest();
case HashAlgorithm.sha512:
return new SHA512Digest();
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例2: cloneHash
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static final Digest cloneHash(int hashAlgorithm, Digest hash)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest((MD5Digest)hash);
case HashAlgorithm.sha1:
return new SHA1Digest((SHA1Digest)hash);
case HashAlgorithm.sha224:
return new SHA224Digest((SHA224Digest)hash);
case HashAlgorithm.sha256:
return new SHA256Digest((SHA256Digest)hash);
case HashAlgorithm.sha384:
return new SHA384Digest((SHA384Digest)hash);
case HashAlgorithm.sha512:
return new SHA512Digest((SHA512Digest)hash);
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例3: createHash
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static Digest createHash(short hashAlgorithm)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest();
case HashAlgorithm.sha1:
return new SHA1Digest();
case HashAlgorithm.sha224:
return new SHA224Digest();
case HashAlgorithm.sha256:
return new SHA256Digest();
case HashAlgorithm.sha384:
return new SHA384Digest();
case HashAlgorithm.sha512:
return new SHA512Digest();
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例4: cloneHash
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static Digest cloneHash(short hashAlgorithm, Digest hash)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest((MD5Digest)hash);
case HashAlgorithm.sha1:
return new SHA1Digest((SHA1Digest)hash);
case HashAlgorithm.sha224:
return new SHA224Digest((SHA224Digest)hash);
case HashAlgorithm.sha256:
return new SHA256Digest((SHA256Digest)hash);
case HashAlgorithm.sha384:
return new SHA384Digest((SHA384Digest)hash);
case HashAlgorithm.sha512:
return new SHA512Digest((SHA512Digest)hash);
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例5: shouldPassSignatureTest2
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
private void shouldPassSignatureTest2()
throws Exception
{
BigInteger n = new BigInteger("b746ba6c3c0be64bbe33aa55b2929b0af4e86d773d44bfe5914db9287788c4663984b61a418d2eecca30d752ff6b620a07ec72eeb2b422d2429da352407b99982800b9dd7697be6a7b1baa98ca5f4fc2fe33400f20b9dba337ac25c987804165d4a6e0ee4d18eabd6de5abdfe578cae6713ff91d16c80a5bb20217fe614d9509e75a43e1825327b9da8f0a9f6eeaa1c04b69fb4bacc073569fff4ab491becbe6d0441d437fc3fa823239c4a0f75321666b68dd3f66e2dd394089a15bcc288a68a4eb0a48e17d639743b9dea0a91cc35820544732aff253f8ca9967c609dc01c2f8cd0313a7a91cfa94ff74289a1d2b6f19d1811f4b9a65f4cce9e5759b4cc64f", 16);
BigInteger e = new BigInteger("dcbbdb", 16);
byte[] msg = Hex.decode("a5d3c8a060f897bbbc20ae0955052f37fbc70986b6e11c65075c9f457142bfa93856897c69020aa81a91b5e4f39e05cdeecc63395ab849c8262ca8bc5c96870aecb8edb0aba0024a9bdb71e06de6100344e5c318bc979ef32b8a49a8278ba99d4861bce42ebbc5c8c666aaa6cac39aff8779f2cae367620f9edd4cb1d80b6c8c");
byte[] sig = Hex.decode("39fbbd1804c689a533b0043f84da0f06081038c0fbf31e443e46a05e58f50de5198bbca40522afefaba3aed7082a6cb93b1da39f1f5a42246bf64930781948d300549bef0f8d554ecfca60a1b1ecba95a7014ee4545ad4f0c4e3a31942c6738b4ccd6244b6a21267dadf0826a5f713f13b1f5a9ab8501d957a26d4948278ac67851071a315674bdab173bfef2c2690c8373da6bf3d69f30c0e5da8883de872f59521b40793854085641adf98d13db991c5d0a8aaa0222934fa33332e90ef0b954e195cb267d6ffb36c96e14d1ec7b915a87598b4461a3146566354dc2ae748c84ee0cd46543b53ebff8cdf47725b280a1f799fb6ebb4a31ad2bdd5178250f83a");
RSAKeyParameters rsaPublic = new RSAKeyParameters(false, n, e);
X931Signer signer = new X931Signer(new RSAEngine(), new SHA224Digest());
signer.init(false, rsaPublic);
signer.update(msg, 0, msg.length);
if (!signer.verifySignature(sig))
{
fail("RSA X931 verify test 2 failed.");
}
}
示例6: createHash
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static final Digest createHash(short hashAlgorithm)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest();
case HashAlgorithm.sha1:
return new SHA1Digest();
case HashAlgorithm.sha224:
return new SHA224Digest();
case HashAlgorithm.sha256:
return new SHA256Digest();
case HashAlgorithm.sha384:
return new SHA384Digest();
case HashAlgorithm.sha512:
return new SHA512Digest();
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例7: cloneHash
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static final Digest cloneHash(short hashAlgorithm, Digest hash)
{
switch (hashAlgorithm)
{
case HashAlgorithm.md5:
return new MD5Digest((MD5Digest)hash);
case HashAlgorithm.sha1:
return new SHA1Digest((SHA1Digest)hash);
case HashAlgorithm.sha224:
return new SHA224Digest((SHA224Digest)hash);
case HashAlgorithm.sha256:
return new SHA256Digest((SHA256Digest)hash);
case HashAlgorithm.sha384:
return new SHA384Digest((SHA384Digest)hash);
case HashAlgorithm.sha512:
return new SHA512Digest((SHA512Digest)hash);
default:
throw new IllegalArgumentException("unknown HashAlgorithm");
}
}
示例8: guessDigest
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
private Digest guessDigest(int size)
{
switch (size)
{
case 20:
return new SHA1Digest();
case 28:
return new SHA224Digest();
case 32:
return new SHA256Digest();
case 48:
return new SHA384Digest();
case 64:
return new SHA512Digest();
}
return null;
}
示例9: performTest
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public void performTest()
{
RainbowParameters params = new RainbowParameters();
RainbowKeyPairGenerator rainbowKeyGen = new RainbowKeyPairGenerator();
RainbowKeyGenerationParameters genParam = new RainbowKeyGenerationParameters(keyRandom, params);
rainbowKeyGen.init(genParam);
AsymmetricCipherKeyPair pair = rainbowKeyGen.generateKeyPair();
ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), keyRandom);
DigestingMessageSigner rainbowSigner = new DigestingMessageSigner(new RainbowSigner() , new SHA224Digest());
rainbowSigner.init(true, param);
byte[] message = BigIntegers.asUnsignedByteArray(new BigInteger("968236873715988614170569073515315707566766479517"));
rainbowSigner.update(message, 0, message.length);
byte[] sig = rainbowSigner.generateSignature();
rainbowSigner.init(false, pair.getPublic());
rainbowSigner.update(message, 0, message.length);
if (!rainbowSigner.verify(sig))
{
fail("verification fails");
}
}
示例10: getDigest
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static Digest getDigest(
String digestName)
{
digestName = Strings.toUpperCase(digestName);
if (sha1.contains(digestName))
{
return new SHA1Digest();
}
if (md5.contains(digestName))
{
return new MD5Digest();
}
if (sha224.contains(digestName))
{
return new SHA224Digest();
}
if (sha256.contains(digestName))
{
return new SHA256Digest();
}
if (sha384.contains(digestName))
{
return new SHA384Digest();
}
if (sha512.contains(digestName))
{
return new SHA512Digest();
}
return null;
}
示例11: clone
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public Object clone()
throws CloneNotSupportedException
{
Digest d = (Digest)super.clone();
d.digest = new SHA224Digest((SHA224Digest)digest);
return d;
}
示例12: createDigest
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
static Digest createDigest(int algorithm)
throws PGPException
{
switch (algorithm)
{
case HashAlgorithmTags.SHA1:
return new SHA1Digest();
case HashAlgorithmTags.SHA224:
return new SHA224Digest();
case HashAlgorithmTags.SHA256:
return new SHA256Digest();
case HashAlgorithmTags.SHA384:
return new SHA384Digest();
case HashAlgorithmTags.SHA512:
return new SHA512Digest();
case HashAlgorithmTags.MD2:
return new MD2Digest();
case HashAlgorithmTags.MD5:
return new MD5Digest();
case HashAlgorithmTags.RIPEMD160:
return new RIPEMD160Digest();
case HashAlgorithmTags.TIGER_192:
return new TigerDigest();
default:
throw new PGPException("cannot recognise digest");
}
}
示例13: initDigesters
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
private static void initDigesters() {
digesters.put("Blake2b", Blake2bDigest.class);
digesters.put("GOST3411", GOST3411Digest.class);
digesters.put("Keccak", KeccakDigest.class);
digesters.put("MD2", MD2Digest.class);
digesters.put("MD4", MD4Digest.class);
digesters.put("MD5", MD5Digest.class);
digesters.put("RIPEMD128", RIPEMD128Digest.class);
digesters.put("RIPEMD160", RIPEMD160Digest.class);
digesters.put("RIPEMD256", RIPEMD256Digest.class);
digesters.put("RIPEMD320", RIPEMD320Digest.class);
digesters.put("SHA1", SHA1Digest.class);
digesters.put("SHA224", SHA224Digest.class);
digesters.put("SHA256", SHA256Digest.class);
digesters.put("SHA384", SHA384Digest.class);
digesters.put("SHA3-512", SHA3Digest.class);
digesters.put("SHA3-256", SHA3Digest.class);
digesters.put("SHA3-224", SHA3Digest.class);
digesters.put("SHA3-384", SHA3Digest.class);
digesters.put("SHA512", SHA512Digest.class);
digesters.put("SHAKE-128", SHAKEDigest.class);
digesters.put("SHAKE-256", SHAKEDigest.class);
digesters.put("Skein256", SkeinDigest.class);
digesters.put("Skein512", SkeinDigest.class);
digesters.put("Skein1024", SkeinDigest.class);
digesters.put("SM3", SM3Digest.class);
digesters.put("Tiger", TigerDigest.class);
digesters.put("Whirlpool", WhirlpoolDigest.class);
}
示例14: getDigest
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static Digest getDigest(
String digestName)
{
digestName = Strings.toUpperCase(digestName);
if (sha1.contains(digestName))
{
return new SHA1Digest();
}
if (md5.contains(digestName))
{
return new MD5Digest();
}
if (sha224.contains(digestName))
{
return new SHA224Digest();
}
if (sha256.contains(digestName))
{
return new SHA256Digest();
}
if (sha384.contains(digestName))
{
return new SHA384Digest();
}
if (sha512.contains(digestName))
{
return new SHA512Digest();
}
if (sha512_224.contains(digestName))
{
return new SHA512tDigest(224);
}
if (sha512_256.contains(digestName))
{
return new SHA512tDigest(256);
}
return null;
}
示例15: bcSHA224
import org.bouncycastle.crypto.digests.SHA224Digest; //导入依赖的package包/类
public static void bcSHA224()
{
Digest digest = new SHA224Digest();
digest.update(src.getBytes(), 0, src.getBytes().length );
byte[] sha224Bytes = new byte[digest.getDigestSize()];
digest.doFinal(sha224Bytes, 0);
System.out.println("bc sha-224:" + org.bouncycastle.util.encoders.Hex.toHexString(sha224Bytes));
}