Package org.vngx.jsch.hash

Examples of org.vngx.jsch.hash.MAC.update()


    try // Create the hashed host using salt and MAC-SHA1
      synchronized( macsha1 ) {  // MAC is not thread-safe
        macsha1.init(_salt);
        byte[] hostBytes = Util.str2byte(_host);
        macsha1.update(hostBytes, 0, hostBytes.length);
        _hashedHost = new byte[macsha1.getBlockSize()];
        macsha1.doFinal(_hashedHost, 0);
      }
    } catch(Exception e) {
      throw new JSchException("Failed to create HashedHostKey: " + e, e);
View Full Code Here


    try {
      MAC macsha1 = getMAC();
      synchronized( macsha1 ) {  // MAC is not thread-safe
        macsha1.init(_salt);
        byte[] hostBytes = Util.str2byte(host);
        macsha1.update(hostBytes, 0, hostBytes.length);
        byte[] hashValue = new byte[macsha1.getBlockSize()];
        macsha1.doFinal(hashValue, 0);
        return Arrays.equals(_hashedHost, hashValue);
      }
    } catch(Exception e) {
View Full Code Here

    while( discard > 0 ) {
      buffer.reset();
      int len = Math.min(discard, buffer.buffer.length);
      getByte(buffer.buffer, 0, len);
      if( discardMac != null ) {
        discardMac.update(buffer.buffer, 0, len);
      }
      discard -= len;
    }
    if( discardMac != null ) {
      discardMac.doFinal(buffer.buffer, 0);
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.