Documentation ¶
Overview ¶
Package b1t6 implements the b1t6 encoding encoding which uses a group of 6 trits to encode each byte. See the IOTA protocol RFC-0015 for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidLength reports an attempt to decode an input which has a trit-length that is not a multiple of 6. ErrInvalidLength = errors.New("length must be a multiple of 6 trits") // ErrInvalidTrits reports an attempt to decode an input that contains an invalid trit sequence. ErrInvalidTrits = errors.New("invalid trits") )
Functions ¶
func Decode ¶
Decode decodes src into DecodedLen(len(in)) bytes of dst and returns the actual number of bytes written. Decode expects that src contains a valid b1t6 encoding and that src has a length that is a multiple of 6, it returns an error otherwise. If src does not contain trits, the behavior of Decode is undefined.
func DecodeTrytes ¶
DecodeTrytes returns the bytes represented by the t6b1 encoded trytes. DecodeTrytes expects that src contains a valid b1t6 encoding and that in has even length, it returns an error otherwise. If src does not contain trytes, the behavior of DecodeTrytes is undefined.
func DecodedLen ¶
DecodedLen returns the byte-length of a decoding of n source trits.
func Encode ¶
Encode encodes src into EncodedLen(len(in)) trits of dst. As a convenience, it returns the number of trits written, but this value is always EncodedLen(len(src)). Encode implements the b1t6 encoding converting a bit string into ternary.
func EncodeToTrytes ¶
EncodeToTrytes returns the encoding of src converted into trytes.
func EncodedLen ¶
EncodedLen returns the trit-length of an encoding of n source bytes.
Types ¶
This section is empty.