Package com.maverick.crypto.digests

Examples of com.maverick.crypto.digests.SHA1Digest.doFinal()


      signature = signatureInt.toByteArray();

      SHA1Digest h = new SHA1Digest();
      h.update(msg, 0, msg.length);
      byte[] data = new byte[h.getDigestSize()];
      h.doFinal(data, 0);

      if(data.length != (signature.length - ASN_SHA1.length)) {
        return false;
      }
View Full Code Here


    SHA1Digest hash = new SHA1Digest();
    hash.update(msg, 0, msg.length);

    byte[] data = new byte[hash.getDigestSize()];
    hash.doFinal(data, 0);


      byte[] tmp = new byte[data.length + ASN_SHA1.length];
      System.arraycopy(ASN_SHA1, 0, tmp, 0, ASN_SHA1.length);
      System.arraycopy(data, 0, tmp, ASN_SHA1.length, data.length);
View Full Code Here

public byte[] sign(byte[] msg) {

    SHA1Digest h = new SHA1Digest();
    h.update(msg, 0, msg.length);
    byte[] data = new byte[h.getDigestSize()];
    h.doFinal(data, 0);
    return Dsa.sign(x, p, q, g, data);
  }

  public boolean equals(Object obj) {
    if (obj instanceof DsaPrivateKey) {
View Full Code Here

      // Create a SHA1 hash of the message
      SHA1Digest h = new SHA1Digest();
      h.update(msg, 0, msg.length);
      byte[] data = new byte[h.getDigestSize()];
      h.doFinal(data, 0);

      return Dsa.verify(y, p, q, g, signature, data);
  }

  /**
 
View Full Code Here

    // Create a SHA1 hash of the message
    SHA1Digest h = new SHA1Digest();
    h.update(msg, 0, msg.length);
    byte[] data = new byte[h.getDigestSize()];
    h.doFinal(data, 0);


    BigInteger m = new BigInteger(1, data);
    m = m.mod(q);
View Full Code Here

      SHA1Digest hash = new SHA1Digest();
      hash.update(msg, 0, msg.length);

      byte[] data = new byte[hash.getDigestSize()];
      hash.doFinal(data, 0);

      byte[] tmp = new byte[data.length + ASN_SHA1.length];
      System.arraycopy(ASN_SHA1, 0, tmp, 0, ASN_SHA1.length);
      System.arraycopy(data, 0, tmp, ASN_SHA1.length, data.length);
      data = tmp;
View Full Code Here

      do {
        random.nextBytes(seed);

        sha1.update(seed, 0, seed.length);

        sha1.doFinal(part1, 0);

        System.arraycopy(seed, 0, part2, 0, seed.length);

        add(part2, seed, 1);
View Full Code Here

        add(part2, seed, 1);

        sha1.update(part2, 0, part2.length);

        sha1.doFinal(part2, 0);

        for (int i = 0; i != u.length; i++) {
          u[i] = (byte) (part1[i] ^ part2[i]);
        }
View Full Code Here

      while (counter < 4096) {
        for (int k = 0; k < n; k++) {
          add(part1, seed, offset + k);
          sha1.update(part1, 0, part1.length);
          sha1.doFinal(part1, 0);
          System.arraycopy(part1, 0, w, w.length - (k + 1) * part1.length,
                           part1.length);
        }

        add(part1, seed, offset + n);
View Full Code Here

                           part1.length);
        }

        add(part1, seed, offset + n);
        sha1.update(part1, 0, part1.length);
        sha1.doFinal(part1, 0);
        System.arraycopy(part1, part1.length - ( (w.length - (n) * part1.length)),
                         w, 0, w.length - n * part1.length);

        w[0] |= (byte) 0x80;

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.