Class IdentityUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetIdentityFromPublicKey(byte[] publicKey) byte[]getPrivateKeyFromSubSeed(byte[] subSeed) byte[]getPublicKeyFromIdentity(String identity) Public key is compressed version of identity.byte[]getPublicKeyFromPrivateKey(byte[] privateKey) byte[]getPublicKeyFromSeed(String seed) byte[]getPublicKeyFromSubSeed(byte[] subSeed) byte[]getSubSeedFromSeed(String seed) getTransactionHash(byte[] signedTxDigest) booleanisValidIdentity(String identity) booleanisValidSeed(String seed)
-
Constructor Details
-
IdentityUtil
-
IdentityUtil
public IdentityUtil()
-
-
Method Details
-
getSubSeedFromSeed
-
getPrivateKeyFromSubSeed
public byte[] getPrivateKeyFromSubSeed(byte[] subSeed) -
getPublicKeyFromPrivateKey
public byte[] getPublicKeyFromPrivateKey(byte[] privateKey) -
getPublicKeyFromSeed
-
getPublicKeyFromSubSeed
public byte[] getPublicKeyFromSubSeed(byte[] subSeed) -
getPublicKeyFromIdentity
Public key is compressed version of identity. The public key is used to communicate with computors about IDs. Little endian.
Chris D.: 32 bytes long public key can be represented by 4 big integers, 8 bytes long each (4 * 8 = 32). Last 4 chars of ID string are checksum, so we are left with 56 chars to decode. We have 4 big ints, each one fits 56 / 4 = 14 chars. Think of each big int having 26 ^ 13 + 25 possible values (has more but not interesting in this case of encoding). Each time we decode one of the 14 chars we find the character's value (by subtracting A, so that A=0, B=1,..., Z=25), we multiply previous big int value (or 0) by 26 and add to it the value of the character (char value is also the result of big int % 26 + A, when encoding).
TL;DR => 56 characters put into four 8 byte values (positive long is good enough).
- Parameters:
identity- The identity to convert.- Returns:
- The public key as a byte[32] array.
-
getIdentityFromPublicKey
-
getTransactionHash
-
isValidSeed
-
isValidIdentity
-