Previous Entry Share Next Entry
12:20 pm, 2 Feb 08

a better use for sha1 URLs

[Here's an old thought I never posted; dumping it here as I clean up my home directory. I never posted it before because I thought I ought to look at existing work in this space before I start feeling too creative -- this seems obvious enough to exist already. Whatever.]

If I use an image, I (in some circumstances, at least) want the display to break if the image changes. If I source an image off of someone else's site and use ("steal") it for my MySpace background, I'd rather see a broken image link than goatse when they notice where their bandwidth is going.

Images don't use the fragment part of their URLs. Let's say from now on I reference images with URLs containing like this:
<img src='http://example.com/foo.png#sha1=012312103120321'>
And then my browser could regard image data that don't have that SHA-1 as a broken image.

Additionally, my browser could implement a cross-site cache of image data. If there are two references to different URLs with the same SHA-1, it only needs to be loaded once. A browser with this functionality could even work with images like
<img src='#sha1=012312103120321'>
which means "pull from cache if you have it, otherwise I give up". In some sense, then, the fragment becomes the real identifier of the image, while the rest of the URL is a hint as to one source to get the image data from.