apr_sha1(8)     DB2 User Defined Function and Stored Procedure     apr_sha1(8)




NAME

       apr_sha1 - DB2 UDF and SP to generate an SHA1 hash


SYNOPSIS

       >>-APR_SHA1--(--expression--)----------------------------------><

       >>-APR_SHA1--(--expression--,--hash--)-------------------------><


DESCRIPTION

       SHA1 algorithm. The apr_sha1 routine is compatible to the function used
       in Apache's htpasswd utility.

       The argument can be a character string that is either a CHAR or VARCHAR
       not exceeding 4096 bytes.

       The  result of the function is CHAR(33). The result can be null; if the
       argument is null, the result is the null value.


EXAMPLES

       Example 1:

       Inserting the user test and the sha1 crypted clear text testpwd to  the
       table users.

       INSERT INTO USERS (username, password)
         VALUES ('test', apr_sha1('testpwd'))

       Example 2:

       SELECT apr_sha1('testpwd') FROM SYSIBM.SYSDUMMY1

       1
       ---------------------------------
       {SHA}mO8HWOaqxvmp4Rl1SMgZC3LJWB0=

         1 record(s) selected.

       Example 3:

       CALL apr_sha1('testpwd', ?)

         Value of output parameters
         --------------------------
         Parameter Name  : HASH
         Parameter Value : {SHA}mO8HWOaqxvmp4Rl1SMgZC3LJWB0=

         Return Status = 0


AUTHOR

       Written by Helmut K. C. Tessarek.


BUGS

       Hopefully none :-) But if you find one, please report it at:
       https://github.com/tessus/db2-hash-routines/issues


WEB SITE

       http://tessus.github.io/db2-hash-routines



apr_sha1                           June 2015                       apr_sha1(8)