Discussion:
ETag Best Practices
John Yeary
2012-01-19 14:58:34 UTC
Permalink
Hello All,

I am trying to come up with some best practices for using ETag. I have been
using a hex conversion of the string and slicing off the first 13 digits,
and a MD5 hash of the the fields. The MD5 hash though seems a little
overkill. I thought about using a CRC32, or Adler hash.

The MD5 hash seems to collide with the HTTP 1.1 specification
Content-MD5[1] header which contains an MD5 hash of the entity.

I did a lot of searching on Google and found a number of different ideas,
but the majority had a hex hash of some sort. Can anyone share their ideas
and code?

Thanks,

John


[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.15
____________________________

John Yeary
____________________________

<http://javaevangelist.blogspot.com/> <https://twitter.com/jyeary>
<http://www.youtube.com/johnyeary>
<http://www.linkedin.com/in/jyeary>
<https://plus.google.com/112146428878473069965>
<http://www.facebook.com/jyeary>
<http://feeds.feedburner.com/JavaEvangelistJohnYearysBlog>
<http://netbeans.org/people/84414-jyeary>
____________________________

"Far better it is to dare mighty things, to win glorious triumphs, even
though checkered by failure, than to take rank with those poor spirits who
neither enjoy much nor suffer much, because they live in the gray twilight
that knows not victory nor defeat."
-- Theodore Roosevelt

Loading...