2021-08-27 06:23:39 +00:00
|
|
|
# OnionCompressor
|
|
|
|
|
|
|
|
Per v3 Tor onion spec: https://github.com/torproject/torspec/blob/main/rend-spec-v3.txt
|
|
|
|
|
|
|
|
This small module 'compresses' v3 onions by decoding the base32, removing the non-security related checksum, and removing the version number.
|
|
|
|
|
|
|
|
The resulting bytes is actually a valid ed25519 public key, but you probably shouldn't use it for anything but normal Tor onion uses.
|
|
|
|
|
|
|
|
It can also uncompress the bytes back to the human friendly format.
|
|
|
|
|
2022-08-24 20:42:24 +00:00
|
|
|
The compressed result is about 50% smaller.
|
|
|
|
|
2021-08-27 06:23:39 +00:00
|
|
|
# Usage
|
|
|
|
|
|
|
|
`compressed: bytes = onioncompressor.compress('duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion')`
|
|
|
|
|
2022-08-24 20:42:24 +00:00
|
|
|
`uncompressed: str: = onioncompressor.decompress(compressed)`
|