Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vjeux/jssmallhash
Compress data into the smallest string
https://github.com/vjeux/jssmallhash
Last synced: about 1 month ago
JSON representation
Compress data into the smallest string
- Host: GitHub
- URL: https://github.com/vjeux/jssmallhash
- Owner: vjeux
- Created: 2010-12-01T17:38:43.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2011-12-14T22:34:11.000Z (about 13 years ago)
- Last Synced: 2024-10-14T05:55:40.134Z (3 months ago)
- Language: JavaScript
- Homepage: http://blog.vjeux.com/2009/javascript/smallhash-information-compression.html
- Size: 96.7 KB
- Stars: 11
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
SmallHash - Information Compression
===============SmallHash encodes any range of integers into the smallest possible string. This way, you can use the hash part of your url with efficiency.
Example
-------```javascript
var input = [0,0,1,3];
var encoded = SmallHash.encode(input, [2,2,3,5], 'abcdefghijklmnopqrstuvwxyz');
var decoded = SmallHash.decode(encoded, [2,2,3,5], 'abcdefghijklmnopqrstuvwxyz');
console.log(input, encoded, decoded);
// Result: [0, 0, 1, 3], "bo", [0, 0, 1, 3]
```Read the full explanation on my blog: http://blog.vjeux.com/2009/javascript/smallhash-information-compression.html