[#45] Add the ability to create a client via wallet and password
Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
parent
fe7d2968b8
commit
db74919401
24 changed files with 141 additions and 558 deletions
|
@ -4,7 +4,6 @@ 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;
|
||||
import java.security.MessageDigest;
|
||||
|
@ -15,24 +14,11 @@ 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() {
|
||||
}
|
||||
|
||||
public static byte[] getRipemd160(byte[] value) {
|
||||
if (isNull(value)) {
|
||||
throw new ValidationFrostFSException(INPUT_PARAM_IS_MISSING);
|
||||
}
|
||||
|
||||
var hash = new byte[RIPEMD_160_HASH_BYTE_LENGTH];
|
||||
var digest = new RIPEMD160Digest();
|
||||
digest.update(value, 0, value.length);
|
||||
digest.doFinal(hash, 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
public static MessageDigest getSha256Instance() {
|
||||
try {
|
||||
return MessageDigest.getInstance(SHA256);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue