
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to generate MD5 hash value
Hi All,
I want to generate MD5 checksum value to compare source and target data for all input columns. So that I can update the data in Target table only when there is change in Checksum value else reject. I goggle for user-defined routines but nothing helped.
I am very new to Talend and dont have much knowledge even on Java.
Helpful if someone could provide steps to do my job.
Regards
Keerthi
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to use Java for this. This cannot really be made "easy" I'm afraid. Take a look here.....
https://www.quickprogrammingtips.com/java/how-to-generate-md5-hash-in-java.html
Referring to this I have put together a method that you can add to a routine.....
public static String getMD5(String data){ java.security.MessageDigest digest = java.security.MessageDigest.getInstance("MD5"); byte[] hash = digest.digest(data.getBytes("UTF-8")); return javax.xml.bind.DatatypeConverter.printHexBinary(hash); }

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for your prompt response. I created the java routine in Talend using your code but unable to view under CATEGORIES.
How can I call the routine, how to pass input columns into the routine and how to compare them with the target/LKP table chksm value ? I tried using it in TMap but unable to proceed. Could you please help me.
Regards,
Keerthi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may want to follow this https://community.talend.com/t5/Design-and-Development/Create-a-user-routine-and-call-it-in-a-Job/ta...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank You for the inputs @rhall. I modified the java code to suit my requirement and it worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi keerthy,
How to do this MD5 checksum value to compare source and target data for all input columns. please share your information step by step and also share your java code.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
