MD5 Message Digest UDF

Downloads
Highlighted
Teradata Employee

MD5 Message Digest UDF

This UDF implements the MD5 message-digest algorithm. The algorithm takes as input a message of arbitrary length and produces as output a 128-bit "fingerprint" or "message digest" of the input (RFC1321). This distribution contains full source code, a test suite, scripts, and documentation.

README

MD5 UDF package for Teradata  Version 2.0 (2008-05-08)

1. Summary

This package includes a UDF that generates MD5 message digest.
For MD5 itself, refer RFC1321[1].

2. Syntax

hash_md5(varchar)

This function takes one char/varchar argument of arbitary length
and always returns 128-bit hash value as hexadecimal char(32) format.
It does not accept NULL value.

The name of the UDF is changed from there is an incompatibility
against previous release.
(see 4. History)

3. Installation

1 unpack the archive and go to src directory
2 start bteq and login to teradata
3 .run file = hash_md5.btq
4 if you would like to validate hash value generated by the UDF,
run md5test_cre.sql, md5test_ins.sql and md5test_chck.sql in the test
directory

You can edit md5.h to customize hash generation.
UDF_MD5_UPPERCASE: if set to 1 (default), generate MD5 result in upper case
UDF_MD5_COMPAT: if set to 1 (not default), generate same result as previous
release (see 4. History)

4. History
Fixed MD5 algorithm that generates wrong result when the input length is
54 + 64*N bytes (N>= 0).

Removed malloc() function which may cause memory problem in UDF.

Fixed compilation issues on Windows platform.

5. Caveat
You should not use these function to encrypt password without 'salt'.

6. Author
KURODA Akira <akira.kuroda@teradata.com>
Teradata Japan

A. Rererences
[1] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, April 1992.

B. Example

hash_md5('')
-> d41d8cd98f00b204e9800998ecf8427e
hash_md5('a')
-> 0cc175b9c0f1b6a831c399e269772661
hash_md5('abc')
-> 900150983cd24fb0d6963f7d28e17f72
hash_md5('message digest')
-> f96b697d7cb7938d525a2f31aaf161d0
hash_md5('message digest')
-> f96b697d7cb7938d525a2f31aaf161d0
hash_md5('abcdefghijklmnopqrstuvwxyz')
-> c3fcd3d76192e4007dfb496cca67e13b
hash_md5('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
-> d174ab98d277d9f5a5611c2c9f419d9f
hash_md5('123456789012345678901234567890123456789012345678901234567890123456
78901234567890')
-> 57edf4a22be3c955ac49da2e2107b67a

Tags (4)
6 REPLIES 6
Enthusiast

Re: MD5 Message Digest UDF

Good Experience to work on this ...
Not applicable

Re: MD5 Message Digest UDF

what is use of MD5?

we can decrypt that possible or not?
Enthusiast

Re: MD5 Message Digest UDF

Hi Akira,
do you know if an UDF exist to decrypt the md5 hashed values again?
Thanks
Enthusiast

Re: MD5 Message Digest UDF

Any chance that there will be an MD6 algorithm? Here is the code: http://ehash.iaik.tugraz.at/wiki/MD6
Not applicable

Re: MD5 Message Digest UDF

Hi
I'm unable to run this function. Getting 5656 error. Please provide me the root cause.
Not applicable

Re: MD5 Message Digest UDF

Hi,
Will this algorithm work for Teradata free version.
Am working on Teradata version 12