Class HashManager


  • public final class HashManager
    extends Manager
    Manager that can be used to determine support for hash functions. By default the Manager announces support for XEP-0300, as well as for the recommended set of hash algorithms. Those contain SHA256, SHA384, SHA512, SHA3-256, SHA3-384, SHA3-512, BLAKE2B256, BLAKE2B384 and BLAKE2B512. Those algorithms got recommended here: https://xmpp.org/extensions/xep-0300.html#recommendations.
    • Method Detail

      • getInstanceFor

        public static HashManager getInstanceFor​(XMPPConnection connection)
        Get an instance of the HashManager for the given connection.
        Parameters:
        connection - TODO javadoc me please
        Returns:
        the manager for the given connection.
      • asFeature

        public static java.lang.String asFeature​(HashManager.ALGORITHM algorithm)
        Return the feature name of the given algorithm.
        Parameters:
        algorithm - eg. 'SHA_1'
        Returns:
        feature name (eg. urn:xmpp:hash-function-text-names:sha-1')
      • hash

        public static byte[] hash​(HashManager.ALGORITHM algorithm,
                                  byte[] data)
        Calculate the hash sum of data using algorithm.
        Parameters:
        algorithm - the algorithm to use.
        data - the data to calculate the hash for.
        Returns:
        the hash value produced by the given algorithm for the given data.
      • md5

        public static byte[] md5​(byte[] data)
      • md5

        public static byte[] md5​(java.lang.String data)
      • md5HexString

        public static java.lang.String md5HexString​(byte[] data)
      • md5HexString

        public static java.lang.String md5HexString​(java.lang.String data)
      • sha_1

        public static byte[] sha_1​(byte[] data)
      • sha_1

        public static byte[] sha_1​(java.lang.String data)
      • sha_1HexString

        public static java.lang.String sha_1HexString​(byte[] data)
      • sha_1HexString

        public static java.lang.String sha_1HexString​(java.lang.String data)
      • sha_224

        public static byte[] sha_224​(byte[] data)
      • sha_224

        public static byte[] sha_224​(java.lang.String data)
      • sha_224HexString

        public static java.lang.String sha_224HexString​(byte[] data)
      • sha_224HexString

        public static java.lang.String sha_224HexString​(java.lang.String data)
      • sha_256

        public static byte[] sha_256​(byte[] data)
      • sha_256

        public static byte[] sha_256​(java.lang.String data)
      • sha_256HexString

        public static java.lang.String sha_256HexString​(byte[] data)
      • sha_256HexString

        public static java.lang.String sha_256HexString​(java.lang.String data)
      • sha_384

        public static byte[] sha_384​(byte[] data)
      • sha_384

        public static byte[] sha_384​(java.lang.String data)
      • sha_384HexString

        public static java.lang.String sha_384HexString​(byte[] data)
      • sha_384HexString

        public static java.lang.String sha_384HexString​(java.lang.String data)
      • sha_512

        public static byte[] sha_512​(byte[] data)
      • sha_512

        public static byte[] sha_512​(java.lang.String data)
      • sha_512HexString

        public static java.lang.String sha_512HexString​(byte[] data)
      • sha_512HexString

        public static java.lang.String sha_512HexString​(java.lang.String data)
      • sha3_224

        public static byte[] sha3_224​(byte[] data)
      • sha3_224

        public static byte[] sha3_224​(java.lang.String data)
      • sha3_224HexString

        public static java.lang.String sha3_224HexString​(byte[] data)
      • sha3_224HexString

        public static java.lang.String sha3_224HexString​(java.lang.String data)
      • sha3_256

        public static byte[] sha3_256​(byte[] data)
      • sha3_256

        public static byte[] sha3_256​(java.lang.String data)
      • sha3_256HexString

        public static java.lang.String sha3_256HexString​(byte[] data)
      • sha3_256HexString

        public static java.lang.String sha3_256HexString​(java.lang.String data)
      • sha3_384

        public static byte[] sha3_384​(byte[] data)
      • sha3_384

        public static byte[] sha3_384​(java.lang.String data)
      • sha3_384HexString

        public static java.lang.String sha3_384HexString​(byte[] data)
      • sha3_384HexString

        public static java.lang.String sha3_384HexString​(java.lang.String data)
      • sha3_512

        public static byte[] sha3_512​(byte[] data)
      • sha3_512

        public static byte[] sha3_512​(java.lang.String data)
      • sha3_512HexString

        public static java.lang.String sha3_512HexString​(byte[] data)
      • sha3_512HexString

        public static java.lang.String sha3_512HexString​(java.lang.String data)
      • blake2b160

        public static byte[] blake2b160​(byte[] data)
      • blake2b160

        public static byte[] blake2b160​(java.lang.String data)
      • blake2b160HexString

        public static java.lang.String blake2b160HexString​(java.lang.String data)
      • blake2b256

        public static byte[] blake2b256​(byte[] data)
      • blake2b256

        public static byte[] blake2b256​(java.lang.String data)
      • blake2b256HexString

        public static java.lang.String blake2b256HexString​(java.lang.String data)
      • blake2b384

        public static byte[] blake2b384​(byte[] data)
      • blake2b384

        public static byte[] blake2b384​(java.lang.String data)
      • blake2b384HexString

        public static java.lang.String blake2b384HexString​(java.lang.String data)
      • blake2b512

        public static byte[] blake2b512​(byte[] data)
      • blake2b512

        public static byte[] blake2b512​(java.lang.String data)
      • blake2b512HexString

        public static java.lang.String blake2b512HexString​(java.lang.String data)