Package gnu.java.security.hash

Examples of gnu.java.security.hash.IMessageDigest.update()


        // compute u = H(A | B)
        IMessageDigest hash = srp.newDigest();
        byte[] buffy;
        buffy = Util.trim(A);
        hash.update(buffy, 0, buffy.length);
        buffy = Util.trim(B);
        hash.update(buffy, 0, buffy.length);

        BigInteger u = new BigInteger(1, hash.digest());
View Full Code Here


        IMessageDigest hash = srp.newDigest();
        byte[] buffy;
        buffy = Util.trim(A);
        hash.update(buffy, 0, buffy.length);
        buffy = Util.trim(B);
        hash.update(buffy, 0, buffy.length);

        BigInteger u = new BigInteger(1, hash.digest());

        // compute S = ((A * (v ** u)) ** b) % N
        BigInteger S1 = A.multiply(v.modPow(u, N)).modPow(b, N);
View Full Code Here

        // compute S = ((A * (v ** u)) ** b) % N
        BigInteger S1 = A.multiply(v.modPow(u, N)).modPow(b, N);

        // compute K = H(S) (as of rev 08)
        byte[] s1Bytes = Util.trim(S1);
        hash.update(s1Bytes, 0, s1Bytes.length);

        byte[] K1 = hash.digest();

        BigInteger x = new BigInteger(1, srp.computeX(s, user, password));

View Full Code Here

            B.subtract(BigInteger.valueOf(3L).multiply(v))
            .modPow(a.add(u.multiply(x)), N);

        // compute K = H(S) (as of rev 08)
        byte[] s2Bytes = Util.trim(S2);
        hash.update(s2Bytes, 0, s2Bytes.length);

        byte[] K2 = hash.digest();

        harness.check(Arrays.equals(K1, K2)); // #1,4,7,10
View Full Code Here

    bob.update(message, 0, message.length);

    harness.check(bob.verify(signature), "instance methods");

    IMessageDigest sha = new Sha160();
    sha.update(message, 0, message.length);
    byte[] hash = sha.digest();
    BigInteger[] rs = DSSSignature.sign(privateK, hash);

    harness.check(DSSSignature.verify(publicK, hash, rs), "class methods");
  }
View Full Code Here

            harness.debug(x);
            harness.fail("MessageDigest.getInstance(" + mdName + "): "
                         + String.valueOf(x));
          }

        gnu.update(in, 0, in.length);
        ba1 = gnu.digest();
        ba2 = jce.digest(in);

        harness.check(Arrays.equals(ba1, ba2), "testEquality(" + mdName + ")");
      }
View Full Code Here

    //      IMessageDigest hash = HashFactory.getInstance(md);
    final SRP srp = SRP.instance(md);
    final IMessageDigest hash = srp.newDigest();
    byte[] buffy;
    buffy = Util.trim(A);
    hash.update(buffy, 0, buffy.length);
    buffy = Util.trim(B);
    hash.update(buffy, 0, buffy.length);

    final BigInteger u = new BigInteger(1, hash.digest());
View Full Code Here

    final IMessageDigest hash = srp.newDigest();
    byte[] buffy;
    buffy = Util.trim(A);
    hash.update(buffy, 0, buffy.length);
    buffy = Util.trim(B);
    hash.update(buffy, 0, buffy.length);

    final BigInteger u = new BigInteger(1, hash.digest());

    // compute S = ((A * (v ** u)) ** b) % N
    final BigInteger S1 = A.multiply(v.modPow(u, N)).modPow(b, N);
View Full Code Here

    // compute S = ((A * (v ** u)) ** b) % N
    final BigInteger S1 = A.multiply(v.modPow(u, N)).modPow(b, N);

    // compute K = H(S) (as of rev 08)
    final byte[] s1Bytes = Util.trim(S1);
    hash.update(s1Bytes, 0, s1Bytes.length);

    final byte[] K1 = hash.digest();

    final BigInteger x = new BigInteger(1, srp.computeX(salt, user, password));

View Full Code Here

        B.subtract(BigInteger.valueOf(3L).multiply(v))
        .modPow(a.add(u.multiply(x)), N);

    // compute K = H(S) (as of rev 08)
    final byte[] s2Bytes = Util.trim(S2);
    hash.update(s2Bytes, 0, s2Bytes.length);

    final byte[] K2 = hash.digest();

    harness.check(S1.equals(S2));
    harness.check(Arrays.equals(K1, K2));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.