• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MD5Digest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bouncycastle.crypto.digests.MD5Digest的典型用法代码示例。如果您正苦于以下问题:Java MD5Digest类的具体用法?Java MD5Digest怎么用?Java MD5Digest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MD5Digest类属于org.bouncycastle.crypto.digests包,在下文中一共展示了MD5Digest类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createHash

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:TlsUtils.java


示例2: OldPKCS12ParametersGenerator

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
/**
 * Construct a PKCS 12 Parameters generator. This constructor will
 * accept MD5, SHA1, and RIPEMD160.
 *
 * @param digest the digest to be used as the source of derived keys.
 * @exception IllegalArgumentException if an unknown digest is passed in.
 */
public OldPKCS12ParametersGenerator(
    Digest  digest)
{
    this.digest = digest;
    if (digest instanceof MD5Digest)
    {
        u = 128 / 8;
        v = 512 / 8;
    }
    else if (digest instanceof SHA1Digest)
    {
        u = 160 / 8;
        v = 512 / 8;
    }
    else if (digest instanceof RIPEMD160Digest)
    {
        u = 160 / 8;
        v = 512 / 8;
    }
    else
    {
        throw new IllegalArgumentException("Digest " + digest.getAlgorithmName() + " unsupported");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:32,代码来源:BrokenPBE.java


示例3: PRF_legacy

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
static byte[] PRF_legacy(byte[] secret, byte[] label, byte[] labelSeed, int size)
{
    int s_half = (secret.length + 1) / 2;
    byte[] s1 = new byte[s_half];
    byte[] s2 = new byte[s_half];
    System.arraycopy(secret, 0, s1, 0, s_half);
    System.arraycopy(secret, secret.length - s_half, s2, 0, s_half);

    byte[] b1 = new byte[size];
    byte[] b2 = new byte[size];
    hmac_hash(new MD5Digest(), s1, labelSeed, b1);
    hmac_hash(new SHA1Digest(), s2, labelSeed, b2);
    for (int i = 0; i < size; i++)
    {
        b1[i] ^= b2[i];
    }
    return b1;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:TlsUtils.java


示例4: cloneHash

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:TlsUtils.java


示例5: createHMACDigest

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
protected Digest createHMACDigest(int macAlgorithm)
    throws IOException
{
    switch (macAlgorithm)
    {
    case MACAlgorithm._null:
        return null;
    case MACAlgorithm.hmac_md5:
        return new MD5Digest();
    case MACAlgorithm.hmac_sha1:
        return new SHA1Digest();
    case MACAlgorithm.hmac_sha256:
        return new SHA256Digest();
    case MACAlgorithm.hmac_sha384:
        return new SHA384Digest();
    case MACAlgorithm.hmac_sha512:
        return new SHA512Digest();
    default:
        throw new TlsFatalAlert(AlertDescription.internal_error);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:DefaultTlsCipherFactory.java


示例6: assign

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
public void assign(Object value, Assignable variable) {
	// Adds the security provider.
	logger.debug("Adding security provider.");
	Security.addProvider(new BouncyCastleProvider());

	logger.debug("Calculating MD5 Hash.");
	// Converts the input to a byte array.
	byte input[] = value.toString().getBytes();

	// Calculates the MD5 digest.
	MD5Digest md5 = new MD5Digest();
	md5.update(input, 0, input.length);

	// Gets the digest size and hashes it.
	byte[] digest = new byte[md5.getDigestSize()];
	md5.doFinal(digest, 0);

	String hash = new String(Hex.encode(digest));
	logger.debug("Setting Hash [{}] into variable [{}].", hash, variable);
	variable.set(hash);
}
 
开发者ID:aurasphere,项目名称:assignables,代码行数:22,代码来源:MD5AssignmentPolicy.java


示例7: PKCS12ParametersGenerator

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
/**
 * Construct a PKCS 12 Parameters generator. This constructor will
 * accept MD5, SHA1, and RIPEMD160.
 *
 * @param digest the digest to be used as the source of derived keys.
 * @exception IllegalArgumentException if an unknown digest is passed in.
 */
public PKCS12ParametersGenerator(
    Digest  digest)
{
    this.digest = digest;
    if (digest instanceof MD5Digest)
    {
        u = 128 / 8;
        v = 512 / 8;
    }
    else if (digest instanceof SHA1Digest)
    {
        u = 160 / 8;
        v = 512 / 8;
    }
    else if (digest instanceof RIPEMD160Digest)
    {
        u = 160 / 8;
        v = 512 / 8;
    }
    else
    {
        throw new IllegalArgumentException("Digest " + digest.getAlgorithmName() + " unsupported");
    }
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:32,代码来源:PKCS12ParametersGenerator.java


示例8: createHash

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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");
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:21,代码来源:TlsUtils.java


示例9: cloneHash

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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");
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:21,代码来源:TlsUtils.java


示例10: createPasswordDigest

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
private static byte[] createPasswordDigest(
    ByteBuffer buffer, String password, Charset charset)
{
    Digest digest =
      (((buffer.get(ENCRYPTION_FLAGS_OFFSET) & USE_SHA1) != 0) ?
       new SHA1Digest() : new MD5Digest());

    byte[] passwordBytes = new byte[PASSWORD_LENGTH];

    if (password != null) {
      ByteBuffer bb = ColumnImpl.encodeUncompressedText(
          password.toUpperCase(), charset);
      bb.get(passwordBytes, 0,
             Math.min(passwordBytes.length, bb.remaining()));
    }

    // Get digest value
    byte[] digestBytes = hash(digest, passwordBytes, PASSWORD_DIGEST_LENGTH);
    return digestBytes;
}
 
开发者ID:jahlborn,项目名称:jackcessencrypt,代码行数:21,代码来源:MSISAMCryptCodecHandler.java


示例11: createHash

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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");
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:21,代码来源:TlsUtils.java


示例12: cloneHash

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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");
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:21,代码来源:TlsUtils.java


示例13: createHMACDigest

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
protected Digest createHMACDigest(int macAlgorithm) throws IOException
{
    switch (macAlgorithm)
    {
    case MACAlgorithm._null:
        return null;
    case MACAlgorithm.hmac_md5:
        return new MD5Digest();
    case MACAlgorithm.hmac_sha1:
        return new SHA1Digest();
    case MACAlgorithm.hmac_sha256:
        return new SHA256Digest();
    case MACAlgorithm.hmac_sha384:
        return new SHA384Digest();
    case MACAlgorithm.hmac_sha512:
        return new SHA512Digest();
    default:
        throw new TlsFatalAlert(AlertDescription.internal_error);
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:21,代码来源:DefaultTlsCipherFactory.java


示例14: PRF

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
protected static byte[] PRF(byte[] secret, String asciiLabel, byte[] seed, int size)
{
    byte[] label = Strings.toByteArray(asciiLabel);

    int s_half = (secret.length + 1) / 2;
    byte[] s1 = new byte[s_half];
    byte[] s2 = new byte[s_half];
    System.arraycopy(secret, 0, s1, 0, s_half);
    System.arraycopy(secret, secret.length - s_half, s2, 0, s_half);

    byte[] ls = concat(label, seed);

    byte[] buf = new byte[size];
    byte[] prf = new byte[size];
    hmac_hash(new MD5Digest(), s1, ls, prf);
    hmac_hash(new SHA1Digest(), s2, ls, buf);
    for (int i = 0; i < size; i++)
    {
        buf[i] ^= prf[i];
    }
    return buf;
}
 
开发者ID:coova,项目名称:jradius,代码行数:23,代码来源:TlsUtils.java


示例15: calculateKeyBlock_SSL

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
static byte[] calculateKeyBlock_SSL(byte[] master_secret, byte[] random, int size)
{
    Digest md5 = new MD5Digest();
    Digest sha1 = new SHA1Digest();
    int md5Size = md5.getDigestSize();
    byte[] shatmp = new byte[sha1.getDigestSize()];
    byte[] tmp = new byte[size + md5Size];

    int i = 0, pos = 0;
    while (pos < size)
    {
        byte[] ssl3Const = SSL3_CONST[i];

        sha1.update(ssl3Const, 0, ssl3Const.length);
        sha1.update(master_secret, 0, master_secret.length);
        sha1.update(random, 0, random.length);
        sha1.doFinal(shatmp, 0);

        md5.update(master_secret, 0, master_secret.length);
        md5.update(shatmp, 0, shatmp.length);
        md5.doFinal(tmp, pos);

        pos += md5Size;
        ++i;
    }

    byte rval[] = new byte[size];
    System.arraycopy(tmp, 0, rval, 0, size);
    return rval;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:31,代码来源:TlsUtils.java


示例16: calculateMasterSecret_SSL

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
static byte[] calculateMasterSecret_SSL(byte[] pre_master_secret, byte[] random)
{
    Digest md5 = new MD5Digest();
    Digest sha1 = new SHA1Digest();
    int md5Size = md5.getDigestSize();
    byte[] shatmp = new byte[sha1.getDigestSize()];

    byte[] rval = new byte[md5Size * 3];
    int pos = 0;

    for (int i = 0; i < 3; ++i)
    {
        byte[] ssl3Const = SSL3_CONST[i];

        sha1.update(ssl3Const, 0, ssl3Const.length);
        sha1.update(pre_master_secret, 0, pre_master_secret.length);
        sha1.update(random, 0, random.length);
        sha1.doFinal(shatmp, 0);

        md5.update(pre_master_secret, 0, pre_master_secret.length);
        md5.update(shatmp, 0, shatmp.length);
        md5.doFinal(rval, pos);

        pos += md5Size;
    }

    return rval;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:29,代码来源:TlsUtils.java


示例17: getDigest

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:33,代码来源:DigestFactory.java


示例18: clone

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的package包/类
public Object clone()
    throws CloneNotSupportedException
{
    Digest d = (Digest)super.clone();
    d.digest = new MD5Digest((MD5Digest)digest);

    return d;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:9,代码来源:MD5.java


示例19: createDigest

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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");
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:28,代码来源:BcImplProvider.java


示例20: initDigesters

import org.bouncycastle.crypto.digests.MD5Digest; //导入依赖的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);
}
 
开发者ID:shilongdai,项目名称:vsDiaryWriter,代码行数:30,代码来源:Digesters.java



注:本文中的org.bouncycastle.crypto.digests.MD5Digest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AnnotationAction类代码示例发布时间:2022-05-21
下一篇:
Java Get类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap