X: Adding DecodingPrimitives helper class
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
package com.r35157.libs.jupiter.perps.impl.anchoridl;
|
||||||
|
|
||||||
|
public class DecodingPrimitives {
|
||||||
|
|
||||||
|
public static byte[] readU128(byte[] data, int offset) {
|
||||||
|
byte[] bytes = new byte[U128_LENGTH];
|
||||||
|
|
||||||
|
for (int i = 0; i < U128_LENGTH; i++) {
|
||||||
|
bytes[i] = data[offset + U128_LENGTH - 1 - i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] readPublicKey(byte[] data, int offset) {
|
||||||
|
byte[] publicKeyBytes = new byte[PUBLIC_KEY_LENGTH];
|
||||||
|
|
||||||
|
System.arraycopy(
|
||||||
|
data,
|
||||||
|
offset,
|
||||||
|
publicKeyBytes,
|
||||||
|
0,
|
||||||
|
PUBLIC_KEY_LENGTH
|
||||||
|
);
|
||||||
|
|
||||||
|
return publicKeyBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int U128_LENGTH = 16;
|
||||||
|
public static final int PUBLIC_KEY_LENGTH = 32;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user