Package org.jivesoftware.smackx.hashes
Class HashManager
java.lang.Object
org.jivesoftware.smack.Manager
org.jivesoftware.smackx.hashes.HashManager
public final class HashManager
extends org.jivesoftware.smack.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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAlgorithmsToFeatures(List<HashManager.ALGORITHM> algorithms) Announce support for the given list of algorithms.static StringasFeature(HashManager.ALGORITHM algorithm) Return the feature name of the given algorithm.static HashElementassembleHashElement(HashManager.ALGORITHM algorithm, byte[] hash) static byte[]blake2b160(byte[] data) static byte[]blake2b160(String data) static Stringblake2b160HexString(byte[] data) static Stringblake2b160HexString(String data) static byte[]blake2b256(byte[] data) static byte[]blake2b256(String data) static Stringblake2b256HexString(byte[] data) static Stringblake2b256HexString(String data) static byte[]blake2b384(byte[] data) static byte[]blake2b384(String data) static Stringblake2b384HexString(byte[] data) static Stringblake2b384HexString(String data) static byte[]blake2b512(byte[] data) static byte[]blake2b512(String data) static Stringblake2b512HexString(byte[] data) static Stringblake2b512HexString(String data) static HashElementcalculateHashElement(HashManager.ALGORITHM algorithm, byte[] data) static HashManagergetInstanceFor(org.jivesoftware.smack.XMPPConnection connection) Get an instance of the HashManager for the given connection.static MessageDigestgetMessageDigest(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 Stringmd5HexString(byte[] data) static Stringmd5HexString(String data) static byte[]sha_1(byte[] data) static byte[]static Stringsha_1HexString(byte[] data) static Stringsha_1HexString(String data) static byte[]sha_224(byte[] data) static byte[]static Stringsha_224HexString(byte[] data) static Stringsha_224HexString(String data) static byte[]sha_256(byte[] data) static byte[]static Stringsha_256HexString(byte[] data) static Stringsha_256HexString(String data) static byte[]sha_384(byte[] data) static byte[]static Stringsha_384HexString(byte[] data) static Stringsha_384HexString(String data) static byte[]sha_512(byte[] data) static byte[]static Stringsha_512HexString(byte[] data) static Stringsha_512HexString(String data) static byte[]sha3_224(byte[] data) static byte[]static Stringsha3_224HexString(byte[] data) static Stringsha3_224HexString(String data) static byte[]sha3_256(byte[] data) static byte[]static Stringsha3_256HexString(byte[] data) static Stringsha3_256HexString(String data) static byte[]sha3_384(byte[] data) static byte[]static Stringsha3_384HexString(byte[] data) static Stringsha3_384HexString(String data) static byte[]sha3_512(byte[] data) static byte[]static Stringsha3_512HexString(byte[] data) static Stringsha3_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
public static byte[] md5(byte[] data) -
md5
-
md5HexString
-
md5HexString
-
sha_1
public static byte[] sha_1(byte[] data) -
sha_1
-
sha_1HexString
-
sha_1HexString
-
sha_224
public static byte[] sha_224(byte[] data) -
sha_224
-
sha_224HexString
-
sha_224HexString
-
sha_256
public static byte[] sha_256(byte[] data) -
sha_256
-
sha_256HexString
-
sha_256HexString
-
sha_384
public static byte[] sha_384(byte[] data) -
sha_384
-
sha_384HexString
-
sha_384HexString
-
sha_512
public static byte[] sha_512(byte[] data) -
sha_512
-
sha_512HexString
-
sha_512HexString
-
sha3_224
public static byte[] sha3_224(byte[] data) -
sha3_224
-
sha3_224HexString
-
sha3_224HexString
-
sha3_256
public static byte[] sha3_256(byte[] data) -
sha3_256
-
sha3_256HexString
-
sha3_256HexString
-
sha3_384
public static byte[] sha3_384(byte[] data) -
sha3_384
-
sha3_384HexString
-
sha3_384HexString
-
sha3_512
public static byte[] sha3_512(byte[] data) -
sha3_512
-
sha3_512HexString
-
sha3_512HexString
-
blake2b160
public static byte[] blake2b160(byte[] data) -
blake2b160
-
blake2b160HexString
-
blake2b160HexString
-
blake2b256
public static byte[] blake2b256(byte[] data) -
blake2b256
-
blake2b256HexString
-
blake2b256HexString
-
blake2b384
public static byte[] blake2b384(byte[] data) -
blake2b384
-
blake2b384HexString
-
blake2b384HexString
-
blake2b512
public static byte[] blake2b512(byte[] data) -
blake2b512
-
blake2b512HexString
-
blake2b512HexString
-