Documentation ¶
Overview ¶
Package t5b1 implements the t5b1 encoding encoding which uses one byte to represent each 5-trit group.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes src into DecodedLen(len(src)) trits of dst and returns the actual number of bytes written. Decode expects that src contains a valid t5b1 encoding, it returns an error otherwise.
func DecodeToTrytes ¶
DecodeToTrytes returns the trytes represented by the t5b1 encoded bytes. The returned trytes always have a length of Ceil(DecodedLen(len(src))/3). DecodeToTrytes expects that src contains a valid t5b1 encoding of a tryte-string. If the input is malformed or does not contain the correct zero padding, it returns an error.
func DecodedLen ¶
DecodedLen returns the trit-length of a decoding of n source bytes.
func Encode ¶
Encode encodes src into EncodedLen(len(src)) bytes of dst. As a convenience, it returns the number of trits written, but this value is always EncodedLen(len(src)). Encode implements the t5b1 encoding converting a trit string into binary. If the length of src is not a multiple of 5, it is padded with zeroes. If src does not contain trits, the behavior of Encode is undefined.
func EncodeTrytes ¶
EncodeTrytes returns the encoding of src converted into bytes. If the corresponding number of trits of src is not a multiple of 5, it is padded with zeroes. If src does not contain valid trytes, the behavior is undefined.
func EncodedLen ¶
EncodedLen returns the byte-length of an encoding of n source trits.
Types ¶
This section is empty.