<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use hash in talend in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277886#M53519</link>
    <description>Hi,
&lt;BR /&gt;1st, define a routine for conversion (here, mine is called GetHashCode and convert to MD5):
&lt;BR /&gt;
&lt;PRE&gt;package routines;&lt;BR /&gt;import java.security.*;&lt;BR /&gt;public class GetHashCode {&lt;BR /&gt;	public static String getMD5(String strCode) {&lt;BR /&gt;		java.security.MessageDigest msg;&lt;BR /&gt;		String digest1 = "";&lt;BR /&gt;		try {&lt;BR /&gt;			msg = java.security.MessageDigest.getInstance("MD5");&lt;BR /&gt;			msg.update(strCode.getBytes(), 0, strCode.length());&lt;BR /&gt;			digest1 = new java.math.BigInteger(1, msg.digest()).toString(32);&lt;BR /&gt;		}&lt;BR /&gt;		catch (NoSuchAlgorithmException e) {&lt;BR /&gt;			// TODO Auto-generated catch block&lt;BR /&gt;			e.printStackTrace();&lt;BR /&gt;		}&lt;BR /&gt;		return digest1.toUpperCase();&lt;BR /&gt;	}&lt;BR /&gt;}&lt;/PRE&gt;
&lt;BR /&gt;In tMap, add the desired field to your schema, then call the routine passing the input fields concateneted, and push the result to the new field (here is an example):
&lt;BR /&gt;
&lt;PRE&gt;GetHashCode.getMD5(row1.col1 + row1.col2 + row1.col3)&lt;/PRE&gt;
&lt;BR /&gt;Hope this helps,
&lt;BR /&gt;TRF</description>
    <pubDate>Tue, 24 Jan 2017 08:55:06 GMT</pubDate>
    <dc:creator>TRF</dc:creator>
    <dc:date>2017-01-24T08:55:06Z</dc:date>
    <item>
      <title>How to use hash in talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277884#M53517</link>
      <description>I am inserting data in a table from another.&lt;BR /&gt;I would like to add a column hash which has hash of all the columns of each row being inserted.&amp;nbsp;&lt;BR /&gt;How would I do that in Talend?&amp;nbsp;&lt;BR /&gt;&amp;nbsp;</description>
      <pubDate>Mon, 23 Jan 2017 17:35:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277884#M53517</guid>
      <dc:creator>dwhdeveloper</dc:creator>
      <dc:date>2017-01-23T17:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use hash in talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277885#M53518</link>
      <description>Can you please explain better what do you want to produce?</description>
      <pubDate>Tue, 24 Jan 2017 08:17:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277885#M53518</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-24T08:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use hash in talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277886#M53519</link>
      <description>Hi,
&lt;BR /&gt;1st, define a routine for conversion (here, mine is called GetHashCode and convert to MD5):
&lt;BR /&gt;
&lt;PRE&gt;package routines;&lt;BR /&gt;import java.security.*;&lt;BR /&gt;public class GetHashCode {&lt;BR /&gt;	public static String getMD5(String strCode) {&lt;BR /&gt;		java.security.MessageDigest msg;&lt;BR /&gt;		String digest1 = "";&lt;BR /&gt;		try {&lt;BR /&gt;			msg = java.security.MessageDigest.getInstance("MD5");&lt;BR /&gt;			msg.update(strCode.getBytes(), 0, strCode.length());&lt;BR /&gt;			digest1 = new java.math.BigInteger(1, msg.digest()).toString(32);&lt;BR /&gt;		}&lt;BR /&gt;		catch (NoSuchAlgorithmException e) {&lt;BR /&gt;			// TODO Auto-generated catch block&lt;BR /&gt;			e.printStackTrace();&lt;BR /&gt;		}&lt;BR /&gt;		return digest1.toUpperCase();&lt;BR /&gt;	}&lt;BR /&gt;}&lt;/PRE&gt;
&lt;BR /&gt;In tMap, add the desired field to your schema, then call the routine passing the input fields concateneted, and push the result to the new field (here is an example):
&lt;BR /&gt;
&lt;PRE&gt;GetHashCode.getMD5(row1.col1 + row1.col2 + row1.col3)&lt;/PRE&gt;
&lt;BR /&gt;Hope this helps,
&lt;BR /&gt;TRF</description>
      <pubDate>Tue, 24 Jan 2017 08:55:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277886#M53519</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-01-24T08:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to use hash in talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277887#M53520</link>
      <description>&lt;P&gt;Hi&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I used this code and it worked perfectly. Is it possible to fix the number of character of the hash?&lt;/P&gt; 
&lt;P&gt;Currently it ranges between 23 and 26 characters, and I'd like to fix that, ensuring I have no duplicates.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:32:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-use-hash-in-talend/m-p/2277887#M53520</guid>
      <dc:creator>offcourse2</dc:creator>
      <dc:date>2019-09-09T15:32:38Z</dc:date>
    </item>
  </channel>
</rss>

