Fixes #147 (rev replaced with hash) #152
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
md5
withcrc
because crc will produce a short 32-bit digest (md5 is 128-bit). Also faster/simpler, though that doesn't really matter.left-pad
andBuffer
to encode the 32-bit crc digest as a base64-encoded string. Theleft-pad
is used because crc returns a Number which sometimes results in a "short" string (eg12345667
instead of01234567
), andBuffer
withhex
decoding expects a series of character pairs. We strip the equal signs base64 uses for padding (those are the characters we saved). Ideally, it'd be nice to use base65536 instead of base64, but I'm worried we'll run into some weird Chrome bugs or something. I'd like to try this anyway in the future, it would reduce the hash length to two characters.I'd like to call the
?version=hash
param as?v=hash
instead to make it shorter but I promised @pizza2code I'd make it explicit. It's ultimately up to you, change it to whatever you want.