Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ZZoghlemi1703518476
Contributor
Contributor

MD5.getHashString or routines code source for Hash Value

i have this routines for hash value but did'nt work , someone have other solution please

routines.Hashage_Fonction.calculateMD5(row1.NUMCNT+row1.CODFAM+row1.CODPROD+row1.FORMCNT+row1.NATCLT+row1.IDCLT+row1.SITUAT ) ---> inp_hash

routines.Hashage_Fonction.calculateMD5(row2.NUMCNT+row2.CODFAM+row2.CODPROD+row2.FORMCNT+row2.NATCLT+row2.IDCLT+row2.SITUAT) ---> kp_hash

(!Var.inp_hash.equals(Var.kp_hash))?"updpted":"ot_updated" 

package routines;

//Import necessary libraries

import java.security.MessageDigest;

import java.security.NoSuchAlgorithmException;

import java.nio.charset.StandardCharsets;

import org.apache.commons.codec.binary.Hex;

import java.security.MessageDigest;

import java.security.NoSuchAlgorithmException;

public class Hashage_Fonction {

  public static String calculateMD5(String input) {

    try {

      MessageDigest md = MessageDigest.getInstance("MD5");

      md.update(input.getBytes());

      byte[] digest = md.digest();

      StringBuilder hexString = new StringBuilder();

      for (byte b : digest) {

        hexString.append(String.format("%02x", b));

      }

      return hexString.toString();

    } catch (NoSuchAlgorithmException e) {

      e.printStackTrace();

      return null;

    }

  }

}

please any help

thanks

0 Replies