[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bacula-devel] space saving in the database

On Monday 11 February 2008 21.02:23 Marc Cousin wrote:
> On Monday 11 February 2008 20:46:09 Bill Moran wrote:
> > In response to Marc Cousin <cousinmarc@xxxxxxxxx>:
> >
> > [snip]
> >
> > > Still, I'd like to know if the md5 field is always a multiple of 32
> > > bits in length ?
> >
> > md5 is _always_ exactly 128 bits.  It's frequently represented as a 32
> > character hex string, but that's just a friendly way to display it.
> >
> > If you use a bytea field (for example) you can lock it in at 128 bits.
> > That will help overall by only taking up 20 bytes instead of 36 bytes
> > for the text string representation, but you have the 4-byte length
> > header either way.
> Yes but in the md5 field, we can also have sha1 or sha256. And maybe
> something else in the future ?
> Those 3 are 128, 160 and 256 bits, so they are ok for my algorithm... I bet
> I should just work with this assumption

Thanks to Bill for answering the question of bit sizes.  I am personally not 
someone who enjoys working with bits, so without doing a bit of research I 
would not have been able to give the above figures.

In response to your question, you are, of course, free to do what you like, 
but I would be very unlikely to accept any code that assumes that the size is 
a multiple of 32 bits because I cannot predict the future and that particular 
restriction might be a bit painful.

This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
Bacula-devel mailing list

This mailing list archive is a service of Copilot Consulting.