MD5 Message Digest UDF

Extensibility
Enthusiast

MD5 Message Digest UDF

I am trying to install this downable function for MD5 but get the error below.

https://downloads.teradata.com/download/extensibility/md5-message-digest-udf

It is a bit old (dates back to 2008) - is it still valid with TD14.10? Is there a new function that replaces it - cannot see it in the Functions manual.

All help gratefully received.

 BTEQ -- Enter your SQL request or BTEQ command:

.run file = hash_md5.btq

.run file = hash_md5.btq

 BTEQ -- Enter your SQL request or BTEQ command:

/* script to install the UDF */

replace TD_SYSFNLIB.function hash_md5

  (arg varchar(32000) character set latin)

  returns char(32) character set latin

  language c

  no sql

  external name 'ci:md5:md5.h:cs:md5:md5.c:cs:md5_latin:udf_md5_latin.c:F:

md5_latin'

  parameter style td_general;

replace TD_SYSFNLIB.function hash_md5

        $

 *** Failure 3706 Syntax error: Expecting the word QUERY.

                Statement# 1, Info =9

 *** Total elapsed time was 1 second.

 BTEQ -- Enter your SQL request or BTEQ command:

 *** Warning: EOF on INPUT stream.

 BTEQ -- Enter your SQL request or BTEQ command:

2 REPLIES
Teradata Employee

Re: MD5 Message Digest UDF

Correct syntax is "replace function databaseName.hash_md5 ..." but you can't add user-defined functions to TD_SYSFNLIB. You could use SYSLIB.

Enthusiast

Re: MD5 Message Digest UDF

Thanks Fred - the UDF Manual has the following so was avoiding SYSLIB hence TD_SYSFNLIB. Going to create a project database to hold this one UDF now.

Recommendation: In general, you should not create UDFs, UDMs, or external stored

procedures in Teradata system databases such as SYSLIB or SYSUDTLIB. These databases are

primarily used for Teradata system UDFs, UDTs, UDMs, and external stored procedures only,

and they usually contain a large number of these system external routines. Every time you

create, alter, or drop your external routine in these databases, Teradata must relink your

routine to all the objects of the system external routines. In addition, to execute your routine,

Teradata must load all the shared libraries referenced by the system external routines, and

these libraries may not be related to your routine. This is very inefficient. However, note that

there are cases where you have to create your UDF in a system database. For example, UDFs

used for row level security must reside in the SYSLIB database.