Go package implementation of C4 Asset ID
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd/c4
db
id
util
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTORS
LICENSE
README.md
doc.go
id.go
id_test.go
internals_test.go
tree.go
tree_test.go
treeslice_bench_test.go

README.md

C4 ID - Universally Unique and Consistent Identification

MIT License GoDoc Stories in Ready Build Status

Note: The C4 ID package has recently moved from github.com/Avalanche-io/c4/id to github.com/Avalanche-io/c4, and the API has been cleaned up considerably to perform better and be easier to use. While deprecated the previous C4 ID API will continue to work and remain unchanged at the current c4/id path to give users time to switch.

This is a Go package that implements the C4 ID system SMPTE standard ST 2114:2017. C4 IDs are universally unique and consistent identifiers that standardize the derivation and formatting of data identification so that all users independently agree on the identification of any block or set of blocks of data.

C4 IDs are 90 character long strings suitable for use in filenames, URLs, database fields, or anywhere else that a string identifier might normally be used. In ram C4 IDs are represented in a 64 byte "digest" format.

The id package is a go implementation of the C4 ID standard. It contains tools for generating and parsing C4 IDs, and C4 ID Tree structures.

Example Usage

package main

import (
  "fmt"
  "strings"

  "github.com/Avalanche-io/c4"
)

func main() {

  // Generate a C4 ID for any contiguous block of data...
  id := c4.Identify(strings.NewReader("alfa"))
  fmt.Println(id)
  // output: c43zYcLni5LF9rR4Lg4B8h3Jp8SBwjcnyyeh4bc6gTPHndKuKdjUWx1kJPYhZxYt3zV6tQXpDs2shPsPYjgG81wZM1

  // Generate a C4 ID for any number of non-contiguous blocks...
  var ids c4.IDs
  var inputs = []string{"alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india"}
  for _, input := range inputs {
    ids = append(ids, c4.Identify(strings.NewReader(input)))
  }
  fmt.Println(ids.ID())
  // output: c435RzTWWsjWD1Fi7dxS3idJ7vFgPVR96oE95RfDDT5ue7hRSPENePDjPDJdnV46g7emDzWK8LzJUjGESMG5qzuXqq
}

Releases

Current release: v0.7.0

Previous Releases:

Warning this version uses an incorrect character set for C4 IDs v0.6.0

Links

Videos:

C4 ID Whitepaper

Contributing

Contributions are welcome. Following are some general guidelines for project organization. If you have questions please open an issue.

The master branch holds the current release, older releases can be found by their version number. The dev branch represents the development branch from which bug and feature branches should be taken. Pull requests that are accepted will be merged against the dev branch and then pushed to versioned releases as appropriate.

Feature and bug branches should follow the github integrated naming convention. Features should be given the new tag, and bugs the bug tag. Here is an example of checking out a feature branch:

> git checkout dev
Switched to branch 'dev'
Your branch is up-to-date with 'origin/dev'.
> git checkout -b new/#99_some_github_issue
...

If a branch for an issue is already listed in this repository then check it out and work from it.

License

This software is released under the MIT license. See LICENSE for more information.