All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.whispersystems.curve25519.JCESha512Provider Maven / Gradle / Ivy

There is a newer version: 0.5.0
Show newest version
package org.whispersystems.curve25519;

import org.whispersystems.curve25519.java.Sha512;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class JCESha512Provider implements Sha512 {
  @Override
  public void calculateDigest(byte[] out, byte[] in, long length) {
    try {
      MessageDigest messageDigest = MessageDigest.getInstance("SHA-512");
      messageDigest.update(in, 0, (int)length);
      byte[] digest = messageDigest.digest();
      System.arraycopy(digest, 0, out, 0, digest.length);
    } catch (NoSuchAlgorithmException e) {
      throw new AssertionError(e);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy