forked from TrueCloudLab/frostfs-sdk-java
[#1] add client environment
add client cut code cleanup Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
parent
dc0eef770c
commit
b0db7df192
95 changed files with 1202 additions and 560 deletions
|
@ -18,19 +18,23 @@ public class Helper {
|
|||
return hash;
|
||||
}
|
||||
|
||||
public static byte[] getSha256(byte[] value) {
|
||||
public static MessageDigest getSha256Instance() {
|
||||
try {
|
||||
return MessageDigest.getInstance("SHA-256").digest(value);
|
||||
return MessageDigest.getInstance("SHA-256");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] getSha256(byte[] value) {
|
||||
return getSha256Instance().digest(value);
|
||||
}
|
||||
|
||||
public static ByteString getSha256(AbstractMessage value) {
|
||||
return ByteString.copyFrom(getSha256(value.toByteArray()));
|
||||
}
|
||||
|
||||
public static String пуеHexString(byte[] array) {
|
||||
public static String getHexString(byte[] array) {
|
||||
return String.format("%0" + (array.length << 1) + "x", new BigInteger(1, array));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue