Anyone have any tips on getting the accountid from a public key?
static long getId(byte[] publicKey) throws Exception {
byte[] publicKeyHash = MessageDigest.getInstance("SHA-256").digest(publicKey);
BigInteger bigInteger = new BigInteger(1, new byte[] {publicKeyHash[7], publicKeyHash[6], publicKeyHash[5], publicKeyHash[4], publicKeyHash[3], publicKeyHash[2], publicKeyHash[1], publicKeyHash[0]});
return bigInteger.longValue();
}
I found this snippet in the source code but trying to replicate in JS gives me no results.
Any help?