Package ch.ethz.ssh2.crypto.digest

Examples of ch.ethz.ssh2.crypto.digest.MD5.digest()


  public static DSASignature generateSignature(byte[] message, DSAPrivateKey pk, SecureRandom rnd)
  {
    SHA1 md = new SHA1();
    md.update(message);
    byte[] sha_message = new byte[md.getDigestLength()];
    md.digest(sha_message);

    BigInteger m = new BigInteger(1, sha_message);
    BigInteger k;
    int qBitLength = pk.getQ().bitLength();
View Full Code Here


    /* Inspired by Bouncycastle's DSASigner class */

    SHA1 md = new SHA1();
    md.update(message);
    byte[] sha_message = new byte[md.getDigestLength()];
    md.digest(sha_message);

    BigInteger m = new BigInteger(1, sha_message);

    BigInteger r = ds.getR();
    BigInteger s = ds.getS();
View Full Code Here

  public static DSASignature generateSignature(byte[] message, DSAPrivateKey pk, SecureRandom rnd)
  {
    SHA1 md = new SHA1();
    md.update(message);
    byte[] sha_message = new byte[md.getDigestLength()];
    md.digest(sha_message);

    BigInteger m = new BigInteger(1, sha_message);
    BigInteger k;
    int qBitLength = pk.getQ().bitLength();
View Full Code Here

  public static RSASignature generateSignature(byte[] message, RSAPrivateKey pk) throws IOException
  {
    SHA1 md = new SHA1();
    md.update(message);
    byte[] sha_message = new byte[md.getDigestLength()];
    md.digest(sha_message);

    byte[] der_header = new byte[] { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00,
        0x04, 0x14 };

    int rsa_block_len = (pk.getN().bitLength() + 7) / 8;
View Full Code Here

  public static boolean verifySignature(byte[] message, RSASignature ds, RSAPublicKey dpk) throws IOException
  {
    SHA1 md = new SHA1();
    md.update(message);
    byte[] sha_message = new byte[md.getDigestLength()];
    md.digest(sha_message);

    BigInteger n = dpk.getN();
    BigInteger e = dpk.getE();
    BigInteger s = ds.getS();
View Full Code Here

     */
    private int md5(String s) {
        MD5 md5 = new MD5();
        md5.update(s.getBytes());
        byte[] digest = new byte[16];
        md5.digest(digest);

        // 16 bytes -> 4 bytes
        for (int i=0; i<4; i++)
            digest[i] ^= digest[i+4]+digest[i+8]+digest[i+12];
        return (b2i(digest[0])<< 24)|(b2i(digest[1])<<16)|(b2i(digest[2])<< 8)|b2i(digest[3]);
View Full Code Here

      // salt in this step.
      // This took me two hours until I got AES-xxx running.

      int copy = (keyLen < tmp.length) ? keyLen : tmp.length;

      md5.digest(tmp, 0);

      System.arraycopy(tmp, 0, key, key.length - keyLen, copy);

      keyLen -= copy;
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.