Hey folks, I know we like encoding urls with base64 to keep the automated bots off our hindquarters, I figured out a neat little trick. As I’m sure you are aware, you can share a torrent with the infohash only, without the need to have all the formatting of a magnet link.

The infohash is a 20 byte string represented with hexadecimal, and can be stored as both its ascii string or as just bytes. The interesting thing about base64 is that not only can it be used to encode an ascii string, it can also be used to encode bytes.

As an example, I’m going to use an archive.org torrent, using cryptii.com as the translator, since it allows me to encode bytes. So, we start with our infohash 62ae55f2329e29f79a8d1ed245c84818b5cf84e9 and we’re going to set cryptii to encode to base64, with our input view set to bytes grouped by ‘none’. Out of this, we get Yq5V8jKeKfeajR7SRchIGLXPhOk= Simply mirror the process for decoding.

This produces a base64 string which is actually shorter than the original infohash! This process always seems to produce the = at the end, which does make this unmistakably base64, but if encoded with the base64url standard this will disappear.

I thought this would probably be useful for the future when infohashes get shared on here, just in case automated bots start looking for infohash sized hexadecimal length strings.

  • MeowdyPardner@kbin.social
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Nice tip, though don’t forget to share some trackers too, I’ve been stuck at 0% on a torrent someone shared as only the infohash. I’m guessing their DHT isn’t working, and despite adding trackers, without knowing what trackers any of the other seeds are using it’s just a guessing game adding open trackers blindly, or a waiting game hoping I can find peers using DHT.