Java Code Examples for org.spongycastle.crypto.digests.SHA512Digest#doFinal()

The following examples show how to use org.spongycastle.crypto.digests.SHA512Digest#doFinal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: wallet_api.java    From guarda-android-wallets with GNU General Public License v3.0 6 votes vote down vote up
private private_key derive_private_key(String strWifKey, int nSeqNumber) {
    String strData = strWifKey + " " + nSeqNumber;
    byte[] bytesBuffer = strData.getBytes();
    SHA512Digest digest = new SHA512Digest();
    digest.update(bytesBuffer, 0, bytesBuffer.length);

    byte[] out = new byte[64];
    digest.doFinal(out, 0);

    SHA256Digest digest256 = new SHA256Digest();
    byte[] outSeed = new byte[32];
    digest256.update(out, 0, out.length);
    digest.doFinal(outSeed, 0);

    return new private_key(outSeed);
}
 
Example 2
Source File: wallet_api.java    From bitshares_wallet with MIT License 6 votes vote down vote up
private private_key derive_private_key(String strWifKey, int nSeqNumber) {
    String strData = strWifKey + " " + nSeqNumber;
    byte[] bytesBuffer = strData.getBytes();
    SHA512Digest digest = new SHA512Digest();
    digest.update(bytesBuffer, 0, bytesBuffer.length);

    byte[] out = new byte[64];
    digest.doFinal(out, 0);

    SHA256Digest digest256 = new SHA256Digest();
    byte[] outSeed = new byte[32];
    digest256.update(out, 0, out.length);
    digest.doFinal(outSeed, 0);

    return new private_key(outSeed);
}
 
Example 3
Source File: sha512_object.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
public static sha512_object create_from_string(String strContent) {
    SHA512Digest digest = new SHA512Digest();
    byte[] bytePassword = strContent.getBytes();
    digest.update(bytePassword, 0, bytePassword.length);

    byte[] byteHash = new byte[64];
    digest.doFinal(byteHash, 0);

    sha512_object sha512Object = new sha512_object();
    System.arraycopy(byteHash, 0, sha512Object.hash, 0, byteHash.length);

    return sha512Object;
}
 
Example 4
Source File: sha512_object.java    From AndroidWallet with GNU General Public License v3.0 5 votes vote down vote up
public static sha512_object create_from_byte_array(byte[] byteArray, int offset, int length) {
    SHA512Digest digest = new SHA512Digest();
    digest.update(byteArray, offset, length);

    byte[] byteHash = new byte[64];
    digest.doFinal(byteHash, 0);

    sha512_object sha512Object = new sha512_object();
    System.arraycopy(byteHash, 0, sha512Object.hash, 0, byteHash.length);

    return sha512Object;
}
 
Example 5
Source File: sha512_object.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public static sha512_object create_from_string(String strContent) {
    SHA512Digest digest = new SHA512Digest();
    byte[] bytePassword = strContent.getBytes();
    digest.update(bytePassword, 0, bytePassword.length);

    byte[] byteHash = new byte[64];
    digest.doFinal(byteHash, 0);

    sha512_object sha512Object = new sha512_object();
    System.arraycopy(byteHash, 0, sha512Object.hash, 0, byteHash.length);

    return sha512Object;
}
 
Example 6
Source File: sha512_object.java    From guarda-android-wallets with GNU General Public License v3.0 5 votes vote down vote up
public static sha512_object create_from_byte_array(byte[] byteArray, int offset, int length) {
    SHA512Digest digest = new SHA512Digest();
    digest.update(byteArray, offset, length);

    byte[] byteHash = new byte[64];
    digest.doFinal(byteHash, 0);

    sha512_object sha512Object = new sha512_object();
    System.arraycopy(byteHash, 0, sha512Object.hash, 0, byteHash.length);

    return sha512Object;
}
 
Example 7
Source File: sha512_object.java    From bitshares_wallet with MIT License 5 votes vote down vote up
public static sha512_object create_from_string(String strContent) {
    SHA512Digest digest = new SHA512Digest();
    byte[] bytePassword = strContent.getBytes();
    digest.update(bytePassword, 0, bytePassword.length);

    byte[] byteHash = new byte[64];
    digest.doFinal(byteHash, 0);

    sha512_object sha512Object = new sha512_object();
    System.arraycopy(byteHash, 0, sha512Object.hash, 0, byteHash.length);

    return sha512Object;
}
 
Example 8
Source File: sha512_object.java    From bitshares_wallet with MIT License 5 votes vote down vote up
public static sha512_object create_from_byte_array(byte[] byteArray, int offset, int length) {
    SHA512Digest digest = new SHA512Digest();
    digest.update(byteArray, offset, length);

    byte[] byteHash = new byte[64];
    digest.doFinal(byteHash, 0);

    sha512_object sha512Object = new sha512_object();
    System.arraycopy(byteHash, 0, sha512Object.hash, 0, byteHash.length);

    return sha512Object;
}