By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,808 Members | 1,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,808 IT Pros & Developers. It's quick & easy.

sha1 column type

P: n/a
Hello,

I have read several online tutorials advocating storing a sha1() hashed
password in a column of type BLOB. As far as I can tell, sha1() always
returns a string of 40 characters, regardless of the size of the
original input. Is there any reason I can't store this as type CHAR? I
am running MySQL 4.1.x. Thanks in advance.
Jun 26 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Rik
Marcus wrote:
Hello,

I have read several online tutorials advocating storing a sha1()
hashed password in a column of type BLOB. As far as I can tell,
sha1() always returns a string of 40 characters, regardless of the
size of the original input. Is there any reason I can't store this
as type CHAR? I am running MySQL 4.1.x. Thanks in advance.


NATIONAL] CHAR(M) [BINARY | ASCII | UNICODE]
A fixed-length string that is always right-padded with spaces to the
specified length when stored. M represents the column length. The range of M
is 0 to 255 characters.

Should be possible without any problems...

Grtz,
--
Rik Wasmus
Jun 26 '06 #2

P: n/a
On Mon, 26 Jun 2006 13:24:01 -0500, Marcus <Ju********@aol.com> wrote:
I have read several online tutorials advocating storing a sha1() hashed
password in a column of type BLOB. As far as I can tell, sha1() always
returns a string of 40 characters, regardless of the size of the
original input. Is there any reason I can't store this as type CHAR? I
am running MySQL 4.1.x. Thanks in advance.


SHA1 produces a 20-byte hash, for which you could use BLOB, which can also be
represented as a 40-byte hexadecimal string, for which you can use a character
type.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jun 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.