Package org.bouncycastle.crypto.digests

Examples of org.bouncycastle.crypto.digests.SHA256Digest


    public FortunaGenerator() {
      this(null);
    }
   
    public FortunaGenerator(byte[] seed) {
        generator = new Generator(new AESFastEngine(), new SHA256Digest());
        pools = new Digest[NUM_POOLS];
        for (int i = 0; i < NUM_POOLS; i++)
            pools[i] = new SHA256Digest();
        buffer = new byte[256]
      if (seed != null) {
        generator.init(seed);
        fillBlock();
        initialized = true;
View Full Code Here


        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:
View Full Code Here

        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:
View Full Code Here

    static public class SHA256
        extends DigestSignatureSpi
    {
        public SHA256()
        {
            super(NISTObjectIdentifiers.id_sha256, new SHA256Digest(), new PKCS1Encoding(new RSABlindedEngine()));
        }
View Full Code Here

                "\"" + alicePassword + "\" and \"" + bobPassword + "\")\n");

        /*
         * Both participants must use the same hashing algorithm.
         */
        Digest digest = new SHA256Digest();
        SecureRandom random = new SecureRandom();

        JPAKEParticipant alice = new JPAKEParticipant("alice", alicePassword.toCharArray(), group, digest, random);
        JPAKEParticipant bob = new JPAKEParticipant("bob", bobPassword.toCharArray(), group, digest, random);

View Full Code Here

        /*
         * 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);
    }
View Full Code Here

        }
    }

    private static byte[] SingleIterationPBKDF2(byte[] P, byte[] S, int dkLen)
    {
        PBEParametersGenerator pGen = new PKCS5S2ParametersGenerator(new SHA256Digest());
        pGen.init(P, S, 1);
        KeyParameter key = (KeyParameter) pGen.generateDerivedMacParameters(dkLen * 8);
        return key.getKey();
    }
View Full Code Here

        {
            pGen = new DSAParametersGenerator();
        }
        else
        {
            pGen = new DSAParametersGenerator(new SHA256Digest());
        }

        if (random == null)
        {
            random = new SecureRandom();
View Full Code Here

                    break;
                case TIGER:
                    generator = new PKCS12ParametersGenerator(new TigerDigest());
                    break;
                case SHA256:
                    generator = new PKCS12ParametersGenerator(new SHA256Digest());
                    break;
                case GOST3411:
                    generator = new PKCS12ParametersGenerator(new GOST3411Digest());
                    break;
                default:
View Full Code Here

    {
        this(
            participantId,
            password,
            group,
            new SHA256Digest(),
            new SecureRandom());
    }
View Full Code Here

TOP

Related Classes of org.bouncycastle.crypto.digests.SHA256Digest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.