try {
    //keyMonnet = Provided for Monnet Payments
    String sha512 = payinMerchantID + payinMerchantOperationNumber + payinAmount + payinCurrency + keyMonnet;
    String shaCreado = getStringSHA(sha512.trim());
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
    }

public static String getStringSHA(String str) {

    try {
      MessageDigest md5 = MessageDigest.getInstance("SHA-512");
      md5.reset();
      md5.update(str.getBytes());
      return new String(Hex.encodeHex(md5.digest()));
    } catch (NoSuchAlgorithmException e) {
      e.printStackTrace();
      return null;
    }
  }
<?php
  //keyMonnet = Provided for Monnet Payments
  $purchaseVerication = openssl_digest($_POST['payinMerchantID'] .
  $_POST['payinMerchantOperationNumber'] . $_POST['payinAmount'] .
  $_POST['payinCurrency']. $keyMonnet, 'sha512');
?>