CTNHashProc - CTN Hashing Extended Stored Procedure for MS SQLServer 2000 v 1.2.2 - http://anmar.eu.org/projects/ctnhashproc/ Intoduction -------------------------------- CTNHashProc is a MS SQLServer 2000 Extended Stored Procedure that returns the hash of a given string. Hash is returned on hexadecimal. Currently the supported hash functions are linked from Crypto++ and are the following: @type HASH --------------------------------- 1 SHA 2 SHA2 (SHA-256) 3 SHA2 (SHA-384) 4 SHA2 (SHA-512) 11 MD5 20 RIPEMD-160 25 Tiger Any other hash function supported by the library Crypto++ Version 5.1 (http://www.cryptopp.com) may be added easy to CTNHashProc. An unsupported hash function can also be added but you need a C++ implementation of the function or a libray that supports it. Install and uninstall notes -------------------------------- - INSTALL Copy xp_CTNHashProc.dll to \Binn directory. Add your new Extended Stored Procedure using the SQL Server Enterprise Manager, or by executing the following SQL command: sp_addextendedproc 'xp_ctnhash', 'xp_CTNHashProc.dll' - UNINSTALL You may drop the extended stored procedure by using the SQL command: sp_dropextendedproc 'xp_ctnhash' Then delete xp_CTNHashProc.dll from \Binn directory. You may release the DLL from the Server (to delete or replace the file), by using the SQL command: DBCC xp_ctnhash(FREE) Usage notes -------------------------------- The first parameter determines the hash function, the second the plain string and the third receives the hash of the second. See UsageSample.sql or the following example: declare @type int; declare @pass varchar(30); declare @hash varchar(150); set @type = 4 -- This sets the hash to SHA2 (SHA-512) set @pass = 'My String' -- The original string EXEC master..xp_ctnhash @type, @pass, @hash OUT; -- This calculates SHA2 (SHA-512) print @hash; -- This prints the hash to the console Other notes -------------------------------- To build xp_CTNHashProc.dll open CTNHashProc.vcproj is a VS.NET project. You need to add cryptlib.vcproj from Crypto++ to the work space and correct the paths to the needed header files and cryptlib.lib. Authors -------------------------------- - Angel Marin - http://anmar.eu.org/ Credits -------------------------------- - Wei Dai author of Crypto++ library. All currently hash functions supported are linked from this library. - Oren Novotny author of xp_crypt an MD5 implementation on a SQL 7 Extended Stored Procedure. Many pieces of code and ideas are from xp_crypt. Licence -------------------------------- - CTNHashProc code is under GPL v2 or later, read license.txt - Code taken from xp_crypt is under GPL v2 - The binary linkage to Crypto++ library is under the public domain. Visit http://www.cryptopp.com for details about licensing issues. Cryptography note -------------------------------- REMEMBER THAT EXPORT/IMPORT AND/OR USE OF CRYPTOGRAPHY SOFTWARE, PROVIDING CRYPTOGRAPHY HOOKS OR EVEN JUST COMMUNICATING TECHNICAL DETAILS ABOUT CRYPTOGRAPHY SOFTWARE IS ILLEGAL IN SOME PARTS OF THE WORLD. SO, WHEN YOU IMPORT THIS PACKAGE TO YOUR COUNTRY, RE-DISTRIBUTE IT FROM THERE OR EVEN JUST EMAIL TECHNICAL SUGGESTIONS OR EVEN SOURCE PATCHES TO THE AUTHOR OR OTHER PEOPLE YOU ARE STRONGLY ADVISED TO PAY CLOSE ATTENTION TO ANY EXPORT/IMPORT AND/OR USE LAWS WHICH APPLY TO YOU. THE AUTHORS OF CTNHashProc ARE NOT LIABLE FOR ANY VIOLATIONS YOU MAKE HERE. SO BE CAREFUL, IT IS YOUR RESPONSIBILITY. History -------------------------------- 01/13/2004 - version 1.2.2 - Now rewritten without ussing the old functions from ODS API 05/05/2003 - version 1.2.1 - Linked against Crypto++ 5.1 02/14/2003 - version 1.2 - BugFix release (Hash returned now on lowercase). 10/10/2002 - version 1.1 - Linked against Crypto++ 5.0 09/25/2002 - version 1.0 - First working and public release -------------------------------- Angel Marin 1996 - 2004 - http://anmar.eu.org/