MCPcopy Create free account
hub / github.com/WICG/webpackage / Deterministic

Function Deterministic

go/internal/cbor/deterministic.go:13–24  ·  view source on GitHub ↗

Deterministic function loops through the given byte array containing CBOR sequence and checks that they follow the deterministic principles described here: https://www.rfc-editor.org/rfc/rfc8949.html#name-deterministically-encoded-c.

(input []byte)

Source from the content-addressed store, hash-verified

11// and checks that they follow the deterministic principles described here:
12// https://www.rfc-editor.org/rfc/rfc8949.html#name-deterministically-encoded-c.
13func Deterministic(input []byte) error {
14 index := 0
15
16 for index < len(input) {
17 length, err := deterministicRec(input[index:])
18 if err != nil {
19 return err
20 }
21 index += length
22 }
23 return nil
24}
25
26// deterministicRec is a recursively called helper function to check the deterministicy of a bytes array.
27// TODO(sonkkeli): Recursively called parts will be the maps and arrays, which contain other types, meaning

Calls 1

deterministicRecFunction · 0.70