depolymerization

wire gateway for Bitcoin/Ethereum
Log | Files | Refs | Submodules | README | LICENSE

README.md (709B)


      1 # uri-pack
      2 
      3 uri-pack is an efficient probabilistic binary encoding for URI
      4 
      5 ## Encoding
      6 
      7 Most commonly used characters (a-z . / - %) are encoded using 5b, remaining
      8 ASCII characters are encoded using 11b. If more than half the characters in a
      9 URI are encoded with 5b, the encoded size is smaller than a simple ASCII format.
     10 
     11 On the majestic_million database, 98.77% of the domain name were smaller, going
     12 from an average encoded size of 14B in ASCII to 10B using our format.
     13 
     14 ## Usage
     15 
     16 ```rust
     17 use uri_pack::{pack_uri, unpack_uri};
     18 
     19 let domain = "http://example.com/static_file/image.png";
     20 let encoded = pack_uri(domain).unwrap();
     21 let decoded = unpack_uri(&encoded).unwrap();
     22 assert_eq!(domain, decoded);
     23 ```