Problems storing SHA1 Hash

2003-11-13 Thread Paride De Gasperis
Hello all,
I have a problem storing an SHA1 hash generated as user password for an application...
This is the original SELECT Command:
INSERT INTO Auth$ VALUES ('System', 
'%X;Z(B9?(?U?NE?$03?#j???-#N?[.6?^?', 3)
but the stored values are:
%X;Z(B9?(?U?NE?$03?#j???-#N?[.6?^?
this differes from the original in some characters and the password check fails...
I've tryed changing the table field in some ways but TEXT, BLOB, VARCHAR settings 
produces the same results...
Why?!?!? Anyone can help me?!?!

Thanks a lot for help...





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Problems storing SHA1 Hash

2003-11-13 Thread Sturgeon, Jon
Paride De Gasperis wrote:

 I have a problem storing an SHA1 hash generated as user password for
 an application...

I do the same thing (although not with a MySQL database) and I anticipated
problems in storing the binary hash, so I chose to perform a simple Base64
encoding of the hash result first.  So I end up storing 28-character strings
in the database, like this:

v5szlQNp+vVs1xUZqdYPTe9sgzU=

I find this technique works very well and the code to perform the Base64
encode/decode is straightforward and easily found on the web.

Jon


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Problems storing SHA1 Hash

2003-11-13 Thread Dan Nelson
In the last episode (Nov 13), Paride De Gasperis said:
 Hello all,
 I have a problem storing an SHA1 hash generated as user password for an 
 application...
 This is the original SELECT Command:
 INSERT INTO Auth$ VALUES ('System', '
 % 3/4 
 X;Z^E(xB9?(?U?N~oSSE?$03^O?#^1j?'U'Y??-#N^A?`U[.6?thth^?', 
 3)
 but the stored values are:
 % 3/4 
 X;Z^E(xB9?(?U?N~oSSE?$03^O?#^1j?'U'Y??-#N^A?`U[.6?thth^?
 this differes from the original in some characters and the password check fails...

Those two strings are identical; I moved the first one onto its own
line so they line up.  Make sure the field is not a VARCHAR field (use
a BLOB) and you should be okay.

-- 
Dan Nelson
[EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]