Package uk.num.numlib.util
Class HashUtils
- java.lang.Object
-
- uk.num.numlib.util.HashUtils
-
public final class HashUtils extends java.lang.ObjectHash function for domain names.
-
-
Constructor Summary
Constructors Constructor Description HashUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringdomainAndHash(java.lang.String domain)static java.lang.Stringhash(java.lang.String normalisedDomain, int levels)Generate a SHA1 hash and base36 encode it, then return the first 3 chars separated by '.' and prefixed by '.' The parameter is not checked and the caller must supply a correct value.static java.lang.Stringhash1(java.lang.String normalisedDomain)Generate a SHA1 hash and base36 encode it, then return the first char separated by '.' and prefixed by '.' The parameter is not checked and the caller must supply a correct value.static java.lang.Stringhash2(java.lang.String normalisedDomain)Generate a SHA1 hash and base36 encode it, then return the first 2 chars separated by '.' and prefixed by '.' The parameter is not checked and the caller must supply a correct value.static java.lang.Stringhash3(java.lang.String normalisedDomain)Generate a SHA1 hash and base36 encode it, then return the first 3 chars separated by '.' and prefixed by '.' The parameter is not checked and the caller must supply a correct value.
-
-
-
Method Detail
-
hash
public static java.lang.String hash(java.lang.String normalisedDomain, int levels)Generate a SHA1 hash and base36 encode it, then return the first 3 chars separated by '.' and prefixed by '.' The parameter is not checked and the caller must supply a correct value.- Parameters:
normalisedDomain- java.lang.String the normalised domain name.levels- the number of hash levels- Returns:
- java.lang.String the hash value.
-
domainAndHash
public static java.lang.String domainAndHash(java.lang.String domain)
-
hash1
public static java.lang.String hash1(java.lang.String normalisedDomain)
Generate a SHA1 hash and base36 encode it, then return the first char separated by '.' and prefixed by '.' The parameter is not checked and the caller must supply a correct value.- Parameters:
normalisedDomain- java.lang.String the normalised domain name.- Returns:
- java.lang.String the hash value.
-
hash2
public static java.lang.String hash2(java.lang.String normalisedDomain)
Generate a SHA1 hash and base36 encode it, then return the first 2 chars separated by '.' and prefixed by '.' The parameter is not checked and the caller must supply a correct value.- Parameters:
normalisedDomain- java.lang.String the normalised domain name.- Returns:
- java.lang.String the hash value.
-
hash3
public static java.lang.String hash3(java.lang.String normalisedDomain)
Generate a SHA1 hash and base36 encode it, then return the first 3 chars separated by '.' and prefixed by '.' The parameter is not checked and the caller must supply a correct value.- Parameters:
normalisedDomain- java.lang.String the normalised domain name.- Returns:
- java.lang.String the hash value.
-
-