MCPcopy Create free account
hub / github.com/0xsequence/czip / EncodeWordBytes32Inv

Method EncodeWordBytes32Inv

compressor/encode.go:257–273  ·  view source on GitHub ↗
(word []byte)

Source from the content-addressed store, hash-verified

255}
256
257func (buf *Buffer) EncodeWordBytes32Inv(word []byte) ([]byte, EncodeType, error) {
258 if len(word) > 32 {
259 return nil, Stateless, fmt.Errorf("word exceeds 32 bytes")
260 }
261
262 if len(word) == 0 {
263 return nil, Stateless, fmt.Errorf("word is empty")
264 }
265
266 if !buf.Allows(FLAG_READ_WORD_INV) {
267 return nil, Stateless, fmt.Errorf("bytes32 INV encoding is not allowed")
268 }
269
270 encodedWord := []byte{byte(FLAG_READ_WORD_INV), byte(FLAG_READ_WORD_1 + uint(len(word)) - 1)}
271 encodedWord = append(encodedWord, word...)
272 return encodedWord, Stateless, nil
273}
274
275// Encodes N words
276func (buf *Buffer) WriteNWords(words []byte) (EncodeType, error) {

Callers 1

EncodeWordOptimizedMethod · 0.95

Calls 1

AllowsMethod · 0.95

Tested by

no test coverage detected