Class HashElement

java.lang.Object
org.jivesoftware.smackx.hashes.element.HashElement
All Implemented Interfaces:
org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.ExtensionElement, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlElement, org.jivesoftware.smack.packet.XmlLangElement

public class HashElement extends Object implements org.jivesoftware.smack.packet.ExtensionElement
Represent a hash element.
  • Field Details

  • Constructor Details

    • HashElement

      public HashElement(HashManager.ALGORITHM algorithm, byte[] hash)
      Create a HashElement from pre-calculated values.
      Parameters:
      algorithm - The algorithm which was used.
      hash - the checksum as byte array.
    • HashElement

      public HashElement(HashManager.ALGORITHM algorithm, String hashB64)
      Create a HashElement from pre-calculated values.
      Parameters:
      algorithm - the algorithm that was used.
      hashB64 - the checksum in base 64.
  • Method Details

    • getAlgorithm

      public HashManager.ALGORITHM getAlgorithm()
      Return the hash algorithm used in this HashElement.
      Returns:
      algorithm the algorithm.
    • getHash

      public byte[] getHash()
      Return the checksum as a byte array.
      Returns:
      the hash.
    • getHashB64

      public String getHashB64()
      Return the checksum as a base16 (hex) string.
      Returns:
      the hash.
    • getElementName

      public String getElementName()
      Specified by:
      getElementName in interface org.jivesoftware.smack.packet.NamedElement
    • getNamespace

      public String getNamespace()
      Specified by:
      getNamespace in interface org.jivesoftware.smack.packet.XmlElement
    • toXML

      public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace)
      Specified by:
      toXML in interface org.jivesoftware.smack.packet.Element
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object