Skip to main content
3 of 3
edited tags
mihi
  • 7.3k
  • 2
  • 16
  • 34

What are the maths to convert bytes <-> trytes?

I've heard that one byte contains as much data as "about 5 trits". However, I'm not entirely clear on how the conversion works.

How do I convert binary data into balanced ternary (and vice versa)?

In particular, I am asking because I'd like to implement proper bytes <-> trytes conversion in PyOTA, but I don't understand how to handle edge cases (especially surrounding the "about 5 trits" part).

todofixthis
  • 1.3k
  • 8
  • 23