Package org.jivesoftware.smackx.hashes
Class HashManager
java.lang.Object
org.jivesoftware.smack.Manager
org.jivesoftware.smackx.hashes.HashManager
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAlgorithmsToFeatures
(List<HashManager.ALGORITHM> algorithms) Announce support for the given list of algorithms.static String
asFeature
(HashManager.ALGORITHM algorithm) Return the feature name of the given algorithm.static HashElement
assembleHashElement
(HashManager.ALGORITHM algorithm, byte[] hash) static byte[]
blake2b160
(byte[] data) static byte[]
blake2b160
(String data) static String
blake2b160HexString
(byte[] data) static String
blake2b160HexString
(String data) static byte[]
blake2b256
(byte[] data) static byte[]
blake2b256
(String data) static String
blake2b256HexString
(byte[] data) static String
blake2b256HexString
(String data) static byte[]
blake2b384
(byte[] data) static byte[]
blake2b384
(String data) static String
blake2b384HexString
(byte[] data) static String
blake2b384HexString
(String data) static byte[]
blake2b512
(byte[] data) static byte[]
blake2b512
(String data) static String
blake2b512HexString
(byte[] data) static String
blake2b512HexString
(String data) static HashElement
calculateHashElement
(HashManager.ALGORITHM algorithm, byte[] data) static HashManager
getInstanceFor
(XMPPConnection connection) Get an instance of the HashManager for the given connection.static MessageDigest
getMessageDigest
(HashManager.ALGORITHM algorithm) static byte[]
hash
(HashManager.ALGORITHM algorithm, byte[] data) Calculate the hash sum of data using algorithm.static byte[]
hash
(HashManager.ALGORITHM algorithm, String data) static byte[]
md5
(byte[] data) static byte[]
static String
md5HexString
(byte[] data) static String
md5HexString
(String data) static byte[]
sha_1
(byte[] data) static byte[]
static String
sha_1HexString
(byte[] data) static String
sha_1HexString
(String data) static byte[]
sha_224
(byte[] data) static byte[]
static String
sha_224HexString
(byte[] data) static String
sha_224HexString
(String data) static byte[]
sha_256
(byte[] data) static byte[]
static String
sha_256HexString
(byte[] data) static String
sha_256HexString
(String data) static byte[]
sha_384
(byte[] data) static byte[]
static String
sha_384HexString
(byte[] data) static String
sha_384HexString
(String data) static byte[]
sha_512
(byte[] data) static byte[]
static String
sha_512HexString
(byte[] data) static String
sha_512HexString
(String data) static byte[]
sha3_224
(byte[] data) static byte[]
static String
sha3_224HexString
(byte[] data) static String
sha3_224HexString
(String data) static byte[]
sha3_256
(byte[] data) static byte[]
static String
sha3_256HexString
(byte[] data) static String
sha3_256HexString
(String data) static byte[]
sha3_384
(byte[] data) static byte[]
static String
sha3_384HexString
(byte[] data) static String
sha3_384HexString
(String data) static byte[]
sha3_512
(byte[] data) static byte[]
static String
sha3_512HexString
(byte[] data) static String
sha3_512HexString
(String data) Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
Field Details
-
PREFIX_NS_ALGO
- See Also:
-
RECOMMENDED
-
-
Method Details
-
calculateHashElement
-
assembleHashElement
-
addAlgorithmsToFeatures
Announce support for the given list of algorithms.- Parameters:
algorithms
- TODO javadoc me please
-
getInstanceFor
Get an instance of the HashManager for the given connection.- Parameters:
connection
- TODO javadoc me please- Returns:
- the manager for the given connection.
-
asFeature
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
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.
-
hash
-
getMessageDigest
-
md5
-
md5
-
md5HexString
-
md5HexString
-
sha_1
-
sha_1
-
sha_1HexString
-
sha_1HexString
-
sha_224
-
sha_224
-
sha_224HexString
-
sha_224HexString
-
sha_256
-
sha_256
-
sha_256HexString
-
sha_256HexString
-
sha_384
-
sha_384
-
sha_384HexString
-
sha_384HexString
-
sha_512
-
sha_512
-
sha_512HexString
-
sha_512HexString
-
sha3_224
-
sha3_224
-
sha3_224HexString
-
sha3_224HexString
-
sha3_256
-
sha3_256
-
sha3_256HexString
-
sha3_256HexString
-
sha3_384
-
sha3_384
-
sha3_384HexString
-
sha3_384HexString
-
sha3_512
-
sha3_512
-
sha3_512HexString
-
sha3_512HexString
-
blake2b160
-
blake2b160
-
blake2b160HexString
-
blake2b160HexString
-
blake2b256
-
blake2b256
-
blake2b256HexString
-
blake2b256HexString
-
blake2b384
-
blake2b384
-
blake2b384HexString
-
blake2b384HexString
-
blake2b512
-
blake2b512
-
blake2b512HexString
-
blake2b512HexString
-