public class Hashids extends Object
This is implementation of http://hashids.org v1.0.0 version.
This implementation is immutable, thread-safe, no lock is necessary.
限定符和类型 | 字段和说明 |
---|---|
static long |
MAX_NUMBER
Max number that can be encoded with Hashids.
|
构造器和说明 |
---|
Hashids() |
Hashids(String salt) |
Hashids(String salt,
int minHashLength) |
Hashids(String salt,
int minHashLength,
String alphabet) |
限定符和类型 | 方法和说明 |
---|---|
static int |
checkedCast(long value) |
long[] |
decode(String hash)
Decrypt string to numbers
|
String |
decodeHex(String hash)
Decrypt string to numbers
|
String |
encode(long... numbers)
Encrypt numbers to string
|
String |
encodeHex(String hexa)
Encrypt hexa to string
|
String |
getVersion()
Get Hashid algorithm version.
|
public static final long MAX_NUMBER
public Hashids()
public Hashids(String salt)
public Hashids(String salt, int minHashLength)
public String encode(long... numbers)
numbers
- the numbers to encryptpublic long[] decode(String hash)
hash
- the encrypt stringpublic String encodeHex(String hexa)
hexa
- the hexa to encryptpublic String decodeHex(String hash)
hash
- the encrypt stringpublic static int checkedCast(long value)
public String getVersion()
Copyright © 2017. All rights reserved.