Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / August 2004

Tip: Looking for answers? Try searching our database.

Store Hash in DB

Thread view: 
ngajjar - 21 Aug 2004 23:18 GMT
I need to store a Hash (MD5/SHA1) into the DB. what is the best way to
store it in DB?

- binary string of 16/20 chars
- 32 byte hex
- base64 encoded string

Well, I am not able to store the raw 16byte binary string into the DB, not
sure if it is possible.

My C/CPP program needs to read Hash from the DB and compare it with the
client provided hash. The client is a web application, written in java.

pl, suggest what should i do?

thanks in adv
-nilesh
Oscar kind - 22 Aug 2004 08:23 GMT
> I need to store a Hash (MD5/SHA1) into the DB. what is the best way to
> store it in DB?
[quoted text clipped - 5 lines]
> Well, I am not able to store the raw 16byte binary string into the DB, not
> sure if it is possible.

It is possible, but you'll need to use a binary data type for the column.
Personally, I find this too much hassle though. I want to be able to
manually verify the first few hashes to make sure my algorithm is correct.

Of the other two, it doesn't matter which you use. The 32 character hex
representation is easier to implement though, if you don't have a utility
class for one of the other ready.

> My C/CPP program needs to read Hash from the DB and compare it with the
> client provided hash. The client is a web application, written in java.
>
> pl, suggest what should i do?

It doesn't matter exactly what you do. My preferences are these:

1. SHA-1 hashing algorithm, as it is the hash Dutch banks use.
  (I live in the Netherlands)

2. Use a base64 encoding. Slightly more expensive than hex encoding, but
  password verification doesn't occur that often. Thus my default choice
  is to optimize storage space.

Signature

Oscar Kind                                    http://home.hccnet.nl/okind/
Software Developer                    for contact information, see website

PGP Key fingerprint:    91F3 6C72 F465 5E98 C246  61D9 2C32 8E24 097B B4E2



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.