Michael Muré 5cea53af26 perf(constants): avoid allocating a map for each Decode*() call
```
goos: linux
goarch: amd64
pkg: github.com/ucan-wg/go-varsig
cpu: 13th Gen Intel(R) Core(TM) i7-1360P
                         │    old.txt    │               new.txt                │
                         │    sec/op     │    sec/op     vs base                │
DecodeHashAlgorithm-16     145.65n ± 10%   59.62n ± 30%  -59.07% (p=0.000 n=10)
DecodePayloadEncoding-16   136.65n ± 46%   50.02n ±  5%  -63.40% (p=0.000 n=10)
geomean                     141.1n         54.60n        -61.29%

                         │  old.txt   │               new.txt               │
                         │    B/op    │    B/op     vs base                 │
DecodeHashAlgorithm-16     48.00 ± 0%   48.00 ± 0%       ~ (p=1.000 n=10) ¹
DecodePayloadEncoding-16   48.00 ± 0%   48.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean                    48.00        48.00       +0.00%
¹ all samples are equal

                         │  old.txt   │               new.txt               │
                         │ allocs/op  │ allocs/op   vs base                 │
DecodeHashAlgorithm-16     1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
DecodePayloadEncoding-16   1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                    1.000        1.000       +0.00%
¹ all samples are equal
```
2025-07-08 16:53:40 +02:00
2025-07-08 07:34:57 -04:00

go-varsig

go-varsig implements the upcoming v1.0.0 release of the varsig specification with limited (and soon to be deprecated) support for the varsig < v1.0 specification. This is predominatly included to support the UCAN v1.0 use-case.

Usage

Include the go-varsig library by running the following command:

go get github.com/ucan-wg/go-varsig@latest

Documentation

Documentation for this library is provided as Go docs at https://pkg.go.dev/github.com/ucan-wg/go-varsig.

Development

Install the required development tools using asdf by running the following command in this repository (or install them manually):

asdf install

Checks

This repository contains an set of pre-commit hooks that are run prior to each git commit. You can also run these checks manually using the following command:

pre-commit run --all-files

Github workflows development

ASDF installs act to support Github workflow development - in general, follow these steps to test the workflow:

If you're using podman instead of docker, use the podman socket to simulate the docker daemon:

export DOCKER_HOST=unix:///var/run/podman/podman.sock

Since there's only one workflow, the simplest command to test it is:

act
Description
Multiformat for cryptographic signatures
Readme 137 KiB
Languages
Go 100%