{"id":39706373,"url":"https://github.com/sixafter/nanoid","last_synced_at":"2026-03-14T23:44:39.186Z","repository":{"id":259487989,"uuid":"878046308","full_name":"sixafter/nanoid","owner":"sixafter","description":"A simple, fast, and efficient Go implementation of NanoID, a tiny, secure, URL-friendly, unique string ID generator.","archived":false,"fork":false,"pushed_at":"2026-02-13T01:09:44.000Z","size":6440,"stargazers_count":33,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-21T05:29:22.176Z","etag":null,"topics":["crypto","csrf","fips-140","go","golang","nanoid","nonce","nonces","prngs"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sixafter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-24T17:23:40.000Z","updated_at":"2026-02-13T19:28:21.000Z","dependencies_parsed_at":"2026-02-21T02:13:30.726Z","dependency_job_id":null,"html_url":"https://github.com/sixafter/nanoid","commit_stats":null,"previous_names":["sixafter/nanoid"],"tags_count":84,"template":false,"template_full_name":null,"purl":"pkg:github/sixafter/nanoid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixafter%2Fnanoid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixafter%2Fnanoid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixafter%2Fnanoid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixafter%2Fnanoid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sixafter","download_url":"https://codeload.github.com/sixafter/nanoid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sixafter%2Fnanoid/sbom","scorecard":{"id":1237367,"data":{"date":"2025-09-10T00:57:47Z","repo":{"name":"github.com/sixafter/nanoid","commit":"dbbacf481dff9e22c283bd918089ed606d56bf3a"},"scorecard":{"version":"v5.2.1","commit":"ab2f6e92482462fe66246d9e32f642855a691dc1"},"score":7.5,"checks":[{"name":"Code-Review","score":2,"reason":"Found 8/30 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#code-review"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#security-policy"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: jobLevel 'pull-requests' permission set to 'read': .github/workflows/ci.yaml:34","Warn: jobLevel 'checks' permission set to 'write': .github/workflows/ci.yaml:35","Info: jobLevel 'contents' permission set to 'read': .github/workflows/ci.yaml:33","Info: jobLevel 'pull-requests' permission set to 'read': .github/workflows/release.yaml:25","Info: topLevel permissions set to 'read-all': .github/workflows/ci.yaml:28","Info: topLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yaml:10","Info: topLevel permissions set to 'read-all': .github/workflows/release.yaml:16","Info: topLevel permissions set to 'read-all': .github/workflows/scorecard.yml:20"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":1,"reason":"dependency not pinned by hash detected -- score normalized to 1","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/ci.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yaml:89: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/ci.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yaml:97: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yaml:64: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/codeql-analysis.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yaml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/codeql-analysis.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yaml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/codeql-analysis.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yaml:82: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/codeql-analysis.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yaml:85: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/codeql-analysis.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/release.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/release.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yaml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/release.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yaml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/release.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yaml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/release.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/scorecard.yml:80: update your workflow using https://app.stepsecurity.io/secureworkflow/sixafter/nanoid/scorecard.yml/main?enable=pin","Warn: goCommand not pinned by hash: scripts/go-deps.sh:18","Warn: goCommand not pinned by hash: scripts/go-deps.sh:19","Warn: goCommand not pinned by hash: scripts/go-install.sh:18","Warn: goCommand not pinned by hash: scripts/go-install.sh:20","Info:   2 out of  13 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   6 third-party GitHubAction dependencies pinned","Info:   0 out of   4 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":5,"reason":"badge detected: Passing","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#cii-best-practices"}},{"name":"Dependency-Update-Tool","score":0,"reason":"no update tool detected","details":["Warn: no dependency update tool configurations found"],"documentation":{"short":"Determines if the project uses a dependency update tool.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#dependency-update-tool"}},{"name":"Signed-Releases","score":8,"reason":"5 out of the last 5 releases have a total of 5 signed artifacts.","details":["Info: signed release artifact: checksums.txt.sig: https://github.com/sixafter/nanoid/releases/tag/v1.48.0","Info: signed release artifact: checksums.txt.sig: https://github.com/sixafter/nanoid/releases/tag/v1.47.0","Info: signed release artifact: checksums.txt.sig: https://github.com/sixafter/nanoid/releases/tag/v1.46.0","Info: signed release artifact: checksums.txt.sig: https://github.com/sixafter/nanoid/releases/tag/v1.45.0","Info: signed release artifact: checksums.txt.sig: https://github.com/sixafter/nanoid/releases/tag/v1.44.0","Warn: release artifact v1.48.0 does not have provenance: https://api.github.com/repos/sixafter/nanoid/releases/246025417","Warn: release artifact v1.47.0 does not have provenance: https://api.github.com/repos/sixafter/nanoid/releases/243948581","Warn: release artifact v1.46.0 does not have provenance: https://api.github.com/repos/sixafter/nanoid/releases/243913276","Warn: release artifact v1.45.0 does not have provenance: https://api.github.com/repos/sixafter/nanoid/releases/240017861","Warn: release artifact v1.44.0 does not have provenance: https://api.github.com/repos/sixafter/nanoid/releases/233658653"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#signed-releases"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: GoBuiltInFuzzer integration found: nanoid_fuzz_test.go:24","Info: GoBuiltInFuzzer integration found: nanoid_fuzz_test.go:47","Info: GoBuiltInFuzzer integration found: nanoid_fuzz_test.go:81","Info: GoBuiltInFuzzer integration found: nanoid_fuzz_test.go:116"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#vulnerabilities"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release.yaml:19"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#license"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#sast"}},{"name":"Branch-Protection","score":8,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'main'","Info: 'stale review dismissal' is required to merge on branch 'main'","Warn: required approving review count is 1 on branch 'main'","Info: codeowner review is required on branch 'main'","Info: 'last push approval' is required to merge on branch 'main'","Info: 'up-to-date branches' is required to merge on branch 'main'","Info: status check found to merge onto on branch 'main'","Info: PRs are required in order to make changes on branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#branch-protection"}},{"name":"Contributors","score":0,"reason":"project has 0 contributing companies or organizations -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project has a set of contributors from multiple organizations (e.g., companies).","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#contributors"}},{"name":"CI-Tests","score":9,"reason":"18 out of 20 merged PRs checked by a CI test -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project runs tests before pull requests are merged.","url":"https://github.com/ossf/scorecard/blob/ab2f6e92482462fe66246d9e32f642855a691dc1/docs/checks.md#ci-tests"}}]},"last_synced_at":"2025-09-10T03:54:59.665Z","repository_id":259487989,"created_at":"2025-09-10T03:54:59.666Z","updated_at":"2025-09-10T03:54:59.666Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29681448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T12:30:22.644Z","status":"ssl_error","status_checked_at":"2026-02-21T12:29:55.402Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crypto","csrf","fips-140","go","golang","nanoid","nonce","nonces","prngs"],"created_at":"2026-01-18T10:33:49.613Z","updated_at":"2026-03-14T23:44:39.179Z","avatar_url":"https://github.com/sixafter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"docs/nanoid.svg\"\n     alt=\"NanoID Logo\"\n     align=\"right\"\n     style=\"max-width: 320px; min-width: 160px; width: 30%; height: auto; margin-left: 20px;\" /\u003e\n\n\u003ch3\u003e\u003cstrong\u003enanoid: Tiny. Secure. Random.\u003c/strong\u003e\u003c/h3\u003e\n\n\u003cbr/\u003e\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/sixafter/nanoid)](https://goreportcard.com/report/github.com/sixafter/nanoid)\n[![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](LICENSE)\n[![Go](https://img.shields.io/github/go-mod/go-version/sixafter/nanoid)](https://img.shields.io/github/go-mod/go-version/sixafter/nanoid)\n[![Go Reference](https://pkg.go.dev/badge/github.com/sixafter/nanoid.svg)](https://pkg.go.dev/github.com/sixafter/nanoid)\n[![FIPS-140 Mode Compatible](https://img.shields.io/badge/FIPS‑140--Mode-Compatible-brightgreen)](FIPS-140.md)\n\n\u003cbr clear=\"right\" /\u003e\n\n## Status\n\n[![Release](https://github.com/sixafter/nanoid/workflows/release/badge.svg)](https://github.com/sixafter/nanoid/actions)\n[![CI](https://github.com/sixafter/nanoid/workflows/ci/badge.svg)](https://github.com/sixafter/nanoid/actions)\n[![GitHub issues](https://img.shields.io/github/issues/sixafter/nanoid)](https://github.com/sixafter/nanoid/issues)\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=six-after_nano-id\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=six-after_nano-id)\n![CodeQL](https://github.com/sixafter/nanoid/actions/workflows/codeql-analysis.yaml/badge.svg)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=six-after_nano-id\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=six-after_nano-id)\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/10826/badge)](https://www.bestpractices.dev/projects/10826)\n[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/sixafter/nanoid/badge)](https://scorecard.dev/viewer/?uri=github.com/sixafter/nanoid)\n\n## Overview \n\nA simple, fast, and efficient Go implementation of [Nano ID](https://github.com/ai/nanoid), a tiny, secure, URL-friendly, collision-resistant string generator. \n\nPlease see the [godoc](https://pkg.go.dev/github.com/sixafter/nanoid) for detailed documentation.\n\n## Features\n\n* Uses Go's `crypto/rand` and `x/crypto/chacha20` stream cipher package for generating cryptographically secure random numbers. This guarantees that the generated IDs are both unpredictable and suitable for security-sensitive applications.\n    - The custom Cryptographically Secure Pseudo Random Number Generator (CSPRNG) Includes a thread-safe global `Reader` for concurrent access.\n    - Up to 98% faster when using the `prng.Reader` as a source for v4 UUID generation using Google's [UUID](https://pkg.go.dev/github.com/google/uuid) package.\n* Define your own set of characters for ID generation with a minimum length of 2 characters and maximum length of 256 characters.\n* Define your own random number generator.\n* Unicode and ASCII alphabets are supported.\n* Designed to be safe for use in concurrent environments.\n* Carefully structured to minimize heap allocations, reducing memory overhead and improving cache locality; crucial for applications where performance and resource usage are critical.\n  - 1 `allocs/op` for ASCII and Unicode alphabets regardless of alphabet size or generated ID length.\n  - 0 `allocs/op` for `Reader` interface across ASCII and Unicode alphabets regardless of alphabet size or generated ID length.\n* Lightweight implementation with no external dependencies beyond the standard library other than for tests.\n* Supports `io.Reader` Interface \n  - Used in contexts such as streaming data processing, pipelines, and other I/O-driven operations.\n* Designed to run in FIPS‑140 validated environments using only Go standard library crypto. \n  - For FIPS‑140 compatible random number generation, use the [aes-ctr-drbg](https://github.com/sixafter/aes-ctr-drbg) module.\n  - See [FIPS‑140.md](FIPS-140.md) for details and deployment guidance.\n\nPlease see the [nanoid-cli](https://github.com/sixafter/nanoid-cli) for a command-line interface (CLI) that uses this module to generate Nano IDs.\n\n## Verify with Cosign\n\n[Cosign](https://github.com/sigstore/cosign) is used to sign releases for integrity verification.\n\nTo verify the integrity of the release, follow these steps:\n\n```sh\n# Fetch the latest release tag from GitHub API (e.g., \"v1.64.0\")\nTAG=$(curl -s https://api.github.com/repos/sixafter/nanoid/releases/latest | jq -r .tag_name)\n\n# Remove leading \"v\" for filenames (e.g., \"v1.64.0\" -\u003e \"1.64.0\")\nVERSION=${TAG#v}\n\n# ---------------------------------------------------------------------\n# Verify the source archive using Sigstore bundles\n# ---------------------------------------------------------------------\n\n# Download the release tarball and its signature bundle\ncurl -LO \"https://github.com/sixafter/nanoid/releases/download/${TAG}/nanoid-${VERSION}.tar.gz\"\ncurl -LO \"https://github.com/sixafter/nanoid/releases/download/${TAG}/nanoid-${VERSION}.tar.gz.sigstore.json\"\n\n# Verify the tarball with Cosign using the published public key\ncosign verify-blob \\\n  --key \"https://raw.githubusercontent.com/sixafter/nanoid/main/cosign.pub\" \\\n  --bundle \"nanoid-${VERSION}.tar.gz.sigstore.json\" \\\n  \"nanoid-${VERSION}.tar.gz\"\n\n# ---------------------------------------------------------------------\n# Verify the checksums manifest using Sigstore bundles\n# ---------------------------------------------------------------------\n\ncurl -LO \"https://github.com/sixafter/nanoid/releases/download/${TAG}/checksums.txt\"\ncurl -LO \"https://github.com/sixafter/nanoid/releases/download/${TAG}/checksums.txt.sigstore.json\"\n\ncosign verify-blob \\\n  --key \"https://raw.githubusercontent.com/sixafter/nanoid/main/cosign.pub\" \\\n  --bundle \"checksums.txt.sigstore.json\" \\\n  \"checksums.txt\"\n\n# ---------------------------------------------------------------------\n# Confirm local artifact integrity\n# ---------------------------------------------------------------------\n\nshasum -a 256 -c checksums.txt\n```\n\nIf valid, Cosign will output:\n\n```shell\nVerified OK\n```\n\n## Installation\n\n### Using `go get`\n\nTo install the Nano ID package, run the following command:\n\n```sh\ngo get -u github.com/sixafter/nanoid\n```\n\nTo use the NanoID package in your Go project, import it as follows:\n\n```go\nimport \"github.com/sixafter/nanoid\"\n```\n\n## Usage\n\n### Basic Usage with Default Settings\n\nThe simplest way to generate a Nano ID is by using the default settings. This utilizes the predefined alphabet and default ID length.\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n  \n  \"github.com/sixafter/nanoid\"\n)\n\nfunc main() {\n  id, err := nanoid.New() \n  if err != nil {\n    panic(err)\n  }\n  fmt.Println(\"Generated ID:\", id)\n}\n```\n\n**Output**:\n\n```bash\nGenerated ID: mGbzQkkPBidjL4IP_MwBM\n```\n\n### Generating a Nano ID with Custom length\n\nGenerate a NanoID with a custom length.\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n  \n  \"github.com/sixafter/nanoid\"\n)\n\nfunc main() {\n  id, err := nanoid.NewWithLength(10)\n  if err != nil {\n    panic(err)\n  }\n  fmt.Println(\"Generated ID:\", id)\n}\n```\n\n**Output**:\n\n```bash\nGenerated ID: 1A3F5B7C9D\n```\n\n### Using `io.Reader` Interface\n\nUse the Nano ID generator as an `io.Reader`:\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n  \"io\"\n  \n  \"github.com/sixafter/nanoid\"\n)\n\nfunc main() {\n\t// Nano ID default length is 21\n\tbuf := make([]byte, nanoid.DefaultLength)\n\n\t// Read a Nano ID into the buffer\n\t_, err := nanoid.Read(buf)\n\tif err != nil \u0026\u0026 err != io.EOF {\n\t\tpanic(err)\n\t}\n\n\t// Convert the byte slice to a string\n\tid := string(buf)\n\tfmt.Printf(\"Generated ID: %s\\n\", id)\n}\n```\n\n**Output**:\n\n```bash\nGenerated ID: 2mhTvy21bBZhZcd80ZydM\n```\n\n### Customizing the Alphabet and ID Length\n\nUse the  `WithAlphabet` to customize the alphabet.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/sixafter/nanoid\"\n)\n\nfunc main() {\n\t// Define a custom alphabet\n\talphabet := \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"\n\n\t// Create a new generator with a custom alphabet and length hint\n\tgen, err := nanoid.NewGenerator(\n\t\tnanoid.WithAlphabet(alphabet),\n\t\tnanoid.WithLengthHint(10),\n\t)\n\tif err != nil {\n\t\tfmt.Println(\"Error creating Nano ID generator:\", err)\n\t\treturn\n\t}\n\n\t// Generate a Nano ID using the custom generator\n\tid, err := gen.New() // or gen.NewWithLength(10)\n\tif err != nil {\n\t\tfmt.Println(\"Error generating Nano ID:\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"Generated ID:\", id)\n}\n```\n\n**Output**\"\n\n```bash\nGenerated ID: G5J8K2M0QZ\n```\n\n### Customizing the Random Number Generator\n\nUse the `WithRandReader` option to provide a custom random number generator.\n\n```go\npackage main\n\nimport (\n\t\"crypto/rand\"\n\t\"fmt\"\n\n\t\"github.com/sixafter/nanoid\"\n)\n\nfunc main() {\n\t// Create a new generator with a custom random number generator\n\tgen, err := nanoid.NewGenerator(\n\t\tnanoid.WithRandReader(rand.Reader),\n\t)\n\tif err != nil {\n\t\tfmt.Println(\"Error creating Nano ID generator:\", err)\n\t\treturn\n\t}\n\n\t// Generate a Nano ID using the custom generator with \n\t// the default length.\n\tid, err := gen.New()\n\tif err != nil {\n\t\tfmt.Println(\"Error generating Nano ID:\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"Generated ID:\", id)\n}\n```\n\n**Output**\"\n\n```bash\nGenerated ID: A8I8K3J0QY\n```\n\n## Performance Optimizations\n\nThis benchmark highlights the performance optimizations achieved in this implementation of the Nano ID generator. \nConducted on an Apple M4 Max CPU with 16 cores, and the results demonstrate significant improvements in latency, throughput, \nand memory allocations across various configurations.\n\n| Mode                                 | Latency (ns/op) | Throughput (IDs/sec) | Memory (B/op) | Allocs | Notes                       |\n|:-------------------------------------| --------------: | -------------------: | ------------: | -----: | :-------------------------- |\n| **Serial**                         |            74.1 |              ~13.5 M |            24 |      1 | Single-threaded allocation  |\n| **Parallel (16 cores)**            |             5.6 |               ~178 M |            24 |      1 | Near-linear scalability     |\n| **Buffered Read (optimal 3–5 B)** |            25.0 |                ~40 M |             0 |      0 | Fastest buffered config     |\n| **ASCII ID (21 chars)**           |            54.0 |              ~18.5 M |             0 |      0 | Default configuration       |\n| **Unicode ID (21 chars)**         |           125.0 |               ~8.0 M |            48 |      1 | UTF-8 overhead (~2× slower) |\n\nFor implementation details, benchmark results, and usage, see the CSPRNG [prng-chacha](https://github.com/sixafter/prng-chacha).\n\n## Execute Benchmarks\n\nRun the benchmarks using the  `bench` make target:\n\n```shell\nmake bench\n```\n\n### Interpreting Results:\n\nYour output should look similar to the following:\n\n\u003cdetails\u003e\n  \u003csummary\u003eExpand to see results\u003c/summary\u003e\n\n```shell\nmake bench\ngo test -bench=. -benchmem -memprofile=mem.out -cpuprofile=cpu.out\ngoos: darwin\ngoarch: arm64\npkg: github.com/sixafter/nanoid\ncpu: Apple M4 Max\nBenchmark_Allocations_Serial-16                        \t14830308\t        74.10 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Allocations_Parallel-16                      \t87374926\t        13.93 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Read_DefaultLength-16                        \t21823753\t        54.01 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_VaryingBufferSizes/BufferSize_2-16      \t49202928\t        24.94 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_VaryingBufferSizes/BufferSize_3-16      \t47922843\t        25.39 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_VaryingBufferSizes/BufferSize_5-16      \t44769436\t        27.30 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_VaryingBufferSizes/BufferSize_13-16     \t31385779\t        37.98 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_VaryingBufferSizes/BufferSize_21-16     \t24563296\t        49.45 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_VaryingBufferSizes/BufferSize_34-16     \t17664668\t        67.80 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_ZeroLengthBuffer-16                     \t986404063\t         1.212 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_Concurrent/Concurrency_1-16             \t23469319\t        50.41 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_Concurrent/Concurrency_2-16             \t47287224\t        25.17 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_Concurrent/Concurrency_4-16             \t89502978\t        13.22 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_Concurrent/Concurrency_8-16             \t123994070\t         9.912 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Read_Concurrent/Concurrency_16-16            \t209096799\t         5.656 ns/op\t       0 B/op\t       0 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen2/IDLen8-16  \t31861614\t        37.86 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen2/IDLen16-16 \t22977042\t        51.86 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen2/IDLen21-16 \t18545468\t        64.42 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen2/IDLen32-16 \t15435464\t        76.98 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen2/IDLen64-16 \t 9426519\t       126.7 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen2/IDLen128-16         \t 5483312\t       217.6 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen16/IDLen8-16          \t32191970\t        37.13 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen16/IDLen16-16         \t22994911\t        51.37 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen16/IDLen21-16         \t18733461\t        64.11 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen16/IDLen32-16         \t15541071\t        76.51 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen16/IDLen64-16         \t 9399879\t       127.0 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen16/IDLen128-16        \t 5479530\t       218.4 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen32/IDLen8-16          \t32642143\t        37.36 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen32/IDLen16-16         \t23300292\t        51.40 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen32/IDLen21-16         \t18884118\t        63.52 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen32/IDLen32-16         \t15857773\t        75.56 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen32/IDLen64-16         \t 9551781\t       126.2 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen32/IDLen128-16        \t 5524531\t       217.5 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen64/IDLen8-16          \t32380906\t        37.33 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen64/IDLen16-16         \t22809477\t        51.54 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen64/IDLen21-16         \t18773943\t        63.74 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen64/IDLen32-16         \t15882687\t        75.79 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen64/IDLen64-16         \t 9416259\t       126.7 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/ASCII_AlphabetLen64/IDLen128-16        \t 5503002\t       217.8 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen2/IDLen8-16         \t16668662\t        70.04 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen2/IDLen16-16        \t11526090\t       104.1 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen2/IDLen21-16        \t 9527602\t       125.2 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen2/IDLen32-16        \t 6898809\t       174.3 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen2/IDLen64-16        \t 3853819\t       312.6 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen2/IDLen128-16       \t 2084970\t       575.9 ns/op\t     289 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen16/IDLen8-16        \t17133789\t        69.94 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen16/IDLen16-16       \t11481788\t       105.0 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen16/IDLen21-16       \t 9534361\t       125.9 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen16/IDLen32-16       \t 6850174\t       174.2 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen16/IDLen64-16       \t 3839973\t       311.8 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen16/IDLen128-16      \t 2088130\t       574.6 ns/op\t     289 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen32/IDLen8-16        \t17156673\t        70.04 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen32/IDLen16-16       \t11410390\t       105.0 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen32/IDLen21-16       \t 9537810\t       125.3 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen32/IDLen32-16       \t 6809893\t       175.9 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen32/IDLen64-16       \t 3833170\t       313.1 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen32/IDLen128-16      \t 2081092\t       574.3 ns/op\t     289 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen64/IDLen8-16        \t16723262\t        71.30 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen64/IDLen16-16       \t11270502\t       105.6 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen64/IDLen21-16       \t 9602179\t       125.9 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen64/IDLen32-16       \t 6761265\t       176.4 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen64/IDLen64-16       \t 3848028\t       312.4 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Serial/Unicode_AlphabetLen64/IDLen128-16      \t 2083189\t       576.3 ns/op\t     289 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen2/IDLen8-16         \t194620867\t         6.209 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen2/IDLen16-16        \t141351794\t         9.845 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen2/IDLen21-16        \t100000000\t        11.55 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen2/IDLen32-16        \t81193770\t        14.75 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen2/IDLen64-16        \t45330201\t        26.13 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen2/IDLen128-16       \t25851924\t        46.62 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen16/IDLen8-16        \t216777411\t         5.758 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen16/IDLen16-16       \t144298010\t         8.848 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen16/IDLen21-16       \t100000000\t        11.71 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen16/IDLen32-16       \t83137520\t        13.78 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen16/IDLen64-16       \t47245101\t        25.14 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen16/IDLen128-16      \t26406150\t        45.66 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen32/IDLen8-16        \t188019464\t         5.510 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen32/IDLen16-16       \t149308290\t         8.004 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen32/IDLen21-16       \t100000000\t        11.01 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen32/IDLen32-16       \t83274057\t        13.92 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen32/IDLen64-16       \t46638768\t        25.90 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen32/IDLen128-16      \t26978290\t        44.27 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen64/IDLen8-16        \t206536862\t         5.456 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen64/IDLen16-16       \t152015960\t         8.130 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen64/IDLen21-16       \t100000000\t        10.83 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen64/IDLen32-16       \t84979563\t        13.97 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen64/IDLen64-16       \t48281804\t        24.52 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/ASCII_AlphabetLen64/IDLen128-16      \t26492161\t        43.76 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen2/IDLen8-16       \t100000000\t        12.01 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen2/IDLen16-16      \t60293805\t        19.54 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen2/IDLen21-16      \t53047172\t        21.30 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen2/IDLen32-16      \t37889799\t        32.63 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen2/IDLen64-16      \t21920443\t        54.26 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen2/IDLen128-16     \t12110583\t        99.18 ns/op\t     288 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen16/IDLen8-16      \t98768138\t        12.44 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen16/IDLen16-16     \t59912625\t        20.72 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen16/IDLen21-16     \t55665618\t        22.08 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen16/IDLen32-16     \t36814191\t        31.89 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen16/IDLen64-16     \t21810398\t        54.81 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen16/IDLen128-16    \t12246813\t        98.59 ns/op\t     288 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen32/IDLen8-16      \t94218027\t        11.72 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen32/IDLen16-16     \t62175088\t        19.93 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen32/IDLen21-16     \t52981692\t        21.81 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen32/IDLen32-16     \t37626205\t        31.30 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen32/IDLen64-16     \t22032514\t        53.96 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen32/IDLen128-16    \t12033945\t        98.92 ns/op\t     288 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen64/IDLen8-16      \t100000000\t        11.71 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen64/IDLen16-16     \t58656163\t        21.07 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen64/IDLen21-16     \t55079770\t        21.62 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen64/IDLen32-16     \t38111671\t        31.08 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen64/IDLen64-16     \t22505924\t        53.80 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Parallel/Unicode_AlphabetLen64/IDLen128-16    \t12325257\t        97.61 ns/op\t     288 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen2/IDLen8-16         \t30982933\t        38.31 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen2/IDLen16-16        \t22225959\t        53.39 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen2/IDLen21-16        \t17688570\t        67.18 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen2/IDLen32-16        \t14962710\t        80.15 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen2/IDLen64-16        \t 8811254\t       135.8 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen2/IDLen128-16       \t 5078203\t       236.1 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen16/IDLen8-16        \t31699906\t        38.37 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen16/IDLen16-16       \t22297476\t        53.64 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen16/IDLen21-16       \t17475834\t        67.39 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen16/IDLen32-16       \t14922480\t        80.63 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen16/IDLen64-16       \t 8864101\t       135.1 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen16/IDLen128-16      \t 5098405\t       235.2 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen32/IDLen8-16        \t31704025\t        38.13 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen32/IDLen16-16       \t22310568\t        53.15 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen32/IDLen21-16       \t17880979\t        67.22 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen32/IDLen32-16       \t14910853\t        79.94 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen32/IDLen64-16       \t 8856570\t       135.2 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen32/IDLen128-16      \t 5126726\t       233.6 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen64/IDLen8-16        \t29376333\t        39.24 ns/op\t       8 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen64/IDLen16-16       \t21777496\t        53.67 ns/op\t      16 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen64/IDLen21-16       \t17666781\t        66.84 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen64/IDLen32-16       \t15056240\t        79.63 ns/op\t      32 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen64/IDLen64-16       \t 8923198\t       134.1 ns/op\t      64 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/ASCII_AlphabetLen64/IDLen128-16      \t 5096005\t       232.5 ns/op\t     128 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen2/IDLen8-16       \t16700318\t        72.12 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen2/IDLen16-16      \t10957123\t       108.2 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen2/IDLen21-16      \t 9271933\t       129.5 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen2/IDLen32-16      \t 6679417\t       179.7 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen2/IDLen64-16      \t 3739922\t       321.0 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen2/IDLen128-16     \t 2036672\t       590.0 ns/op\t     288 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen16/IDLen8-16      \t16775415\t        71.37 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen16/IDLen16-16     \t11206695\t       106.8 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen16/IDLen21-16     \t 9401438\t       127.6 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen16/IDLen32-16     \t 6660018\t       180.1 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen16/IDLen64-16     \t 3748488\t       320.5 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen16/IDLen128-16    \t 2034178\t       590.0 ns/op\t     288 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen32/IDLen8-16      \t16434753\t        72.80 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen32/IDLen16-16     \t11008993\t       108.5 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen32/IDLen21-16     \t 9391768\t       127.9 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen32/IDLen32-16     \t 6771036\t       177.6 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen32/IDLen64-16     \t 3759814\t       319.2 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen32/IDLen128-16    \t 2033529\t       589.7 ns/op\t     288 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen64/IDLen8-16      \t16771731\t        71.23 ns/op\t      24 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen64/IDLen16-16     \t11227098\t       106.8 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen64/IDLen21-16     \t 9385282\t       127.8 ns/op\t      48 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen64/IDLen32-16     \t 6751688\t       177.9 ns/op\t      80 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen64/IDLen64-16     \t 3754378\t       319.9 ns/op\t     144 B/op\t       1 allocs/op\nBenchmark_Alphabet_Varying_Length_Varying_Serial/Unicode_AlphabetLen64/IDLen128-16    \t 2040801\t       588.3 ns/op\t     288 B/op\t       1 allocs/op\nPASS\nok  \tgithub.com/sixafter/nanoid\t199.184s\n```\n\u003c/details\u003e\n\n* `ns/op`: Nanoseconds per operation. Lower values indicate faster performance.\n* `B/op`: Bytes allocated per operation. Lower values indicate more memory-efficient code.\n* `allocs/op`: Number of memory allocations per operation. Fewer allocations generally lead to better performance.\n\n## Alphabet Constraints\n\n1. Alphabet Lengths:\n   * At Least Two Characters: The alphabet must contain at least two unique characters. An alphabet with fewer than two characters cannot produce IDs with sufficient variability or randomness.\n   * Maximum Length 256 Characters: The implementation uses a rune-based approach, where a single rune represents each character in the alphabet. This allows for a broad range of unique characters, accommodating alphabets with up to 256 distinct runes. Attempting to use an alphabet with more than 256 runes will result in an error. \n2. Uniqueness of Characters:\n   * All Characters Must Be Unique. Duplicate characters in the alphabet do introduce biases in ID generation and compromise the randomness and uniqueness of the IDs. The generator enforces uniqueness by checking for duplicates during initialization. If duplicates are detected, it will return an `ErrDuplicateCharacters` error. \n3. Character Encoding:\n   * Support for ASCII and Unicode: The generator accepts alphabets containing Unicode characters allowing the inclusion of a wide range of symbols, emojis, or characters from various languages.\n\n## Determining Collisions\n\nTo determine the practical length for a NanoID for your use cases, see the collision time calculator [here](https://sixafter.github.io/nanoid/).\n\n## Contributing\n\nContributions are welcome. See [CONTRIBUTING](CONTRIBUTING.md)\n\n## License\n\nThis project is licensed under the [Apache 2.0 License](https://choosealicense.com/licenses/apache-2.0/). See [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixafter%2Fnanoid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsixafter%2Fnanoid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsixafter%2Fnanoid/lists"}