[#23] Update proto api
Add chain functionality Add tests Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
parent
64e275713f
commit
694bb963e4
38 changed files with 1414 additions and 299 deletions
|
@ -3,6 +3,7 @@ package info.frostfs.sdk;
|
|||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.Message;
|
||||
import info.frostfs.sdk.exceptions.ValidationFrostFSException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bouncycastle.crypto.digests.RIPEMD160Digest;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
@ -15,6 +16,7 @@ import static java.util.Objects.isNull;
|
|||
public class Helper {
|
||||
private static final String SHA256 = "SHA-256";
|
||||
private static final int RIPEMD_160_HASH_BYTE_LENGTH = 20;
|
||||
private static final int HEX_RADIX = 16;
|
||||
|
||||
private Helper() {
|
||||
}
|
||||
|
@ -62,4 +64,12 @@ public class Helper {
|
|||
|
||||
return String.format("%0" + (value.length << 1) + "x", new BigInteger(1, value));
|
||||
}
|
||||
|
||||
public static byte[] getByteArrayFromHex(String hex) {
|
||||
if (StringUtils.isBlank(hex)) {
|
||||
throw new ValidationFrostFSException(INPUT_PARAM_IS_MISSING);
|
||||
}
|
||||
|
||||
return new BigInteger(hex, HEX_RADIX).toByteArray();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue