SHA-1 Message Digest UDF
About this download

This UDF implements the Secure Hash Algorithm, SHA-1, for computing a condensed representation of a message. When a message of any length < 264 bits is input, the SHA-1 produces a 160-bit output called a message digest (FIPS 180-1 / RFC 3174). This distribution contains full source code, a test suite, scripts, and documentation.

README

SHA-1 UDF package for Teradata  Version 1.1 (2008-05-08)

Copyright (c) 2008 Teradata Corporation. All Rights Reserved.
This package is provided "as is". No warranty is provided.


1. Summary

This package includes a UDF which generates SHA-1 message digest.
For SHA-1 itself, refer RFC1321[1].


2. Syntax

 hash_sha1(varchar)

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


3. Installation

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


4. History
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] FIPS PUB 180-1, SECURE HASH STANDARD
http://www.itl.nist.gov/fipspubs/fip180-1.htm

B. Example

hash_sha1('abc')
 -> A9993E364706816ABA3E25717850C26C9CD0D89D

hash_sha1('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq')
 -> 84983E441C3BD26EBAAE4AA1F95129E5E54670F1