Search in sources :

Example 1 with RIPEMD160Digest

use of org.spongycastle.crypto.digests.RIPEMD160Digest in project aion by aionnetwork.

the class HashUtil method ripemd160.

/**
 * Computes the ripemed160 hash fo the given input data.
 *
 * @param data Message to hash
 * @return reipmd160 hash of the message
 */
public static byte[] ripemd160(byte[] data) {
    Digest digest = new RIPEMD160Digest();
    if (data != null) {
        byte[] resBuf = new byte[digest.getDigestSize()];
        digest.update(data, 0, data.length);
        digest.doFinal(resBuf, 0);
        return resBuf;
    }
    throw new NullPointerException("Can't hash a NULL value");
}
Also used : Digest(org.spongycastle.crypto.Digest) MessageDigest(java.security.MessageDigest) KeccakDigest(org.spongycastle.crypto.digests.KeccakDigest) RIPEMD160Digest(org.spongycastle.crypto.digests.RIPEMD160Digest) RIPEMD160Digest(org.spongycastle.crypto.digests.RIPEMD160Digest)

Example 2 with RIPEMD160Digest

use of org.spongycastle.crypto.digests.RIPEMD160Digest in project rskj by rsksmart.

the class HashUtil method ripemd160.

/**
 * @param data - message to hash
 * @return - reipmd160 hash of the message
 */
public static byte[] ripemd160(byte[] data) {
    Digest digest = new RIPEMD160Digest();
    if (data != null) {
        byte[] resBuf = new byte[digest.getDigestSize()];
        digest.update(data, 0, data.length);
        digest.doFinal(resBuf, 0);
        return resBuf;
    }
    throw new NullPointerException("Can't hash a NULL value");
}
Also used : Digest(org.spongycastle.crypto.Digest) MessageDigest(java.security.MessageDigest) RIPEMD160Digest(org.spongycastle.crypto.digests.RIPEMD160Digest) RIPEMD160Digest(org.spongycastle.crypto.digests.RIPEMD160Digest)

Example 3 with RIPEMD160Digest

use of org.spongycastle.crypto.digests.RIPEMD160Digest in project nuls by nuls-io.

the class Utils method sha256hash160.

/**
 * Calculates RIPEMD160(SHA256(input)). This is used in Address calculations.
 */
public static byte[] sha256hash160(byte[] input) {
    byte[] sha256 = Sha256Hash.hash(input);
    RIPEMD160Digest digest = new RIPEMD160Digest();
    digest.update(sha256, 0, sha256.length);
    byte[] out = new byte[20];
    digest.doFinal(out, 0);
    return out;
}
Also used : RIPEMD160Digest(org.spongycastle.crypto.digests.RIPEMD160Digest)

Example 4 with RIPEMD160Digest

use of org.spongycastle.crypto.digests.RIPEMD160Digest in project AppCoins-ethereumj by AppStoreFoundation.

the class HashUtil method ripemd160.

/**
 * @param data - message to hash
 *
 * @return - reipmd160 hash of the message
 */
public static byte[] ripemd160(byte[] data) {
    Digest digest = new RIPEMD160Digest();
    if (data != null) {
        byte[] resBuf = new byte[digest.getDigestSize()];
        digest.update(data, 0, data.length);
        digest.doFinal(resBuf, 0);
        return resBuf;
    }
    throw new NullPointerException("Can't hash a NULL value");
}
Also used : Digest(org.spongycastle.crypto.Digest) MessageDigest(java.security.MessageDigest) RIPEMD160Digest(org.spongycastle.crypto.digests.RIPEMD160Digest) RIPEMD160Digest(org.spongycastle.crypto.digests.RIPEMD160Digest)

Example 5 with RIPEMD160Digest

use of org.spongycastle.crypto.digests.RIPEMD160Digest in project balzac by balzac-lang.

the class BitcoinUtils method ripemd160.

public static Hash ripemd160(byte[] bytes) {
    RIPEMD160Digest digest = new RIPEMD160Digest();
    digest.update(bytes, 0, bytes.length);
    byte[] ripmemdHash = new byte[20];
    digest.doFinal(ripmemdHash, 0);
    return new Hash(ripmemdHash);
}
Also used : RIPEMD160Digest(org.spongycastle.crypto.digests.RIPEMD160Digest) Hash(it.unica.tcs.lib.Hash) Sha256Hash(org.bitcoinj.core.Sha256Hash)

Aggregations

RIPEMD160Digest (org.spongycastle.crypto.digests.RIPEMD160Digest)5 MessageDigest (java.security.MessageDigest)3 Digest (org.spongycastle.crypto.Digest)3 Hash (it.unica.tcs.lib.Hash)1 Sha256Hash (org.bitcoinj.core.Sha256Hash)1 KeccakDigest (org.spongycastle.crypto.digests.KeccakDigest)1