gplana
asked on
Function to encode MD5 in SQL-Server 2012
Hi.
I have created this function to get the MD5 code of a text:
Then I execute these two sentences:
Why aren't they returning the same values?
I have created this function to get the MD5 code of a text:
FUNCTION [dbo].[fn_md5] (@data_a_codificar varchar)
RETURNS CHAR(32) AS
BEGIN
RETURN convert(varchar,hashbytes('MD5',@data_a_codificar),2)
END
Then I execute these two sentences:
select dbo.fn_md5('Hello');
select convert(char,hashbytes('MD5','Hello'),2)
Why aren't they returning the same values?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have mispelled your solution. It works fine.
Thank you.
Thank you.
ASKER
1A8E9B7EA00C8125B37DC3F231
8B1A9953C4611296A827ABF8C4