{"id":33179195,"url":"https://github.com/ksuid/ksuid","last_synced_at":"2026-01-11T17:32:43.393Z","repository":{"id":37026033,"uuid":"354712047","full_name":"ksuid/ksuid","owner":"ksuid","description":"K-Sortable Globally Unique IDs for Java","archived":false,"fork":false,"pushed_at":"2025-08-20T17:54:02.000Z","size":404,"stargazers_count":136,"open_issues_count":1,"forks_count":10,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-08-20T19:41:59.658Z","etag":null,"topics":["coordination","java","ksuid","unique-id","uuid"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksuid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-05T04:03:14.000Z","updated_at":"2025-08-20T17:54:04.000Z","dependencies_parsed_at":"2024-10-23T13:11:56.131Z","dependency_job_id":null,"html_url":"https://github.com/ksuid/ksuid","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ksuid/ksuid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksuid%2Fksuid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksuid%2Fksuid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksuid%2Fksuid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksuid%2Fksuid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksuid","download_url":"https://codeload.github.com/ksuid/ksuid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksuid%2Fksuid/sbom","scorecard":{"id":571680,"data":{"date":"2025-08-11","repo":{"name":"github.com/ksuid/ksuid","commit":"f57b4f89ac0775384f0c90d8dbfff0607bc12097"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/26 approved changesets -- score normalized to 0","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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/maven.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maven.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/ksuid/ksuid/maven.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/maven.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/ksuid/ksuid/maven.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction 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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"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/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T16:30:48.124Z","repository_id":37026033,"created_at":"2025-08-20T16:30:48.124Z","updated_at":"2025-08-20T16:30:48.124Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28315879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"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":["coordination","java","ksuid","unique-id","uuid"],"created_at":"2025-11-16T03:00:36.826Z","updated_at":"2026-01-11T17:32:43.388Z","avatar_url":"https://github.com/ksuid.png","language":"Java","readme":"# ksuid\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.ksuid/ksuid/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.ksuid/ksuid)\n[![Javadoc](https://javadoc.io/badge2/com.github.ksuid/ksuid/javadoc.svg)](https://javadoc.io/doc/com.github.ksuid/ksuid)\n\nThis is a Java port of [Segment's K-Sortable Globally Unique IDs](https://github.com/segmentio/ksuid).\n\nKSUID is for K-Sortable Unique IDentifier. It's a way to generate globally unique IDs similar to RFC 4122 UUIDs,\nbut contain a time component so they can be \"roughly\" sorted by time of creation.\nThe remainder of the KSUID is randomly generated bytes.\n\nIn summary:\n*   Roughly sortable by creation time;\n*   Can be stored as a string of 27 chars;\n*   Can be stored as an array of 20 bytes;\n*   String format is encoded to [base-62](https://en.wikipedia.org/wiki/Base62) (0-9A-Za-z);\n*   String format is URL safe and has no hyphens.\n\nFor the story of how KSUIDs came about, see [A brief history of the UUID](https://segment.com/blog/a-brief-history-of-the-uuid).\n\n## Usage as cli\n\nTo use this as a command-line program on Unix-like systems, run\n\n```bash\nwget https://repo1.maven.org/maven2/com/github/ksuid/ksuid/1.1.4/ksuid-1.1.4-cli.jar\nsudo mv ksuid-1.1.4-cli.jar /usr/local/bin/ksuid.jar\n\nwget https://github.com/ksuid/ksuid/raw/refs/tags/ksuid-1.1.4/ksuid.sh\nsudo mv ksuid.sh /usr/local/bin/ksuid\nsudo chmod +x /usr/local/bin/ksuid\n\nksuid\n# prints 1HCpXwx2EK9oYluWbacgeCnFcLf\n```\n\n## Usage as library\n\nAdd the library to maven pom.xml (or the equivalent in your build system):\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.ksuid\u003c/groupId\u003e\n    \u003cartifactId\u003eksuid\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.4\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nIf using JPMS, add the library to your `module-info.java`:\n\n```java\nrequires com.github.ksuid;\n```\n\nThen simply generate a ksuid string like this:\n\n```java\nimport com.github.ksuid.Ksuid;\n...\nString ksuid = Ksuid.newKsuid().toString();\nSystem.out.println(ksuid); // prints 1HCpXwx2EK9oYluWbacgeCnFcLf\n```\n\n\u0026nbsp;\n\nFor more complex use cases, create a `KsuidGenerator` with a `SecureRandom` and get a new `Ksuid` for use.\n\nNote that `KsuidGenerator` is threadsafe and `Ksuid` is immutable (and therefore threadsafe).\n\n```java\nimport com.github.ksuid.KsuidGenerator;\n...\n\n// Construct a new KsuidGenerator object. Since it is threadsafe you only need one.\nprivate static final KsuidGenerator KSUID_GENERATOR = new KsuidGenerator(new SecureRandom());\n\n// Get a new Ksuid object.\nfinal Ksuid ksuid = ksuidGenerator.newKsuid();\n\n// The toString() method is the string representation of KSUID.\nSystem.out.println(\"ksuid:\\n\" + ksuid  + \"\\n\");\n\n// The log string format shows some details on one line, suitable for logging.\nSystem.out.println(\"ksuid.toLogString():\\n\" + ksuid.toLogString() + \"\\n\");\n\n// The inspect string format shows details.\nSystem.out.println(\"ksuid.toInspectString():\\n\" + ksuid.toInspectString());\n\n```\nThe output from the code block above is\n\n```\nksuid:\n1HCpXwx2EK9oYluWbacgeCnFcLf\n\nksuid.toLogString():\nKsuid[timestamp = 150215977, string = 1HCpXwx2EK9oYluWbacgeCnFcLf payload = [124, 76, 43, -110, 116, -6, \\\n    -91, 45, 0, -125, -127, 109, 28, 24, 28, -17], ksuidBytes = [8, -12, 29, 41, 124, 76, 43, -110, 116, \\\n    -6, -91, 45, 0, -125, -127, 109, 28, 24, 28, -17]]\n\nksuid.toInspectString():\nREPRESENTATION:\n\n  String: 1HCpXwx2EK9oYluWbacgeCnFcLf\n     Raw: 08F41D297C4C2B9274FAA52D0083816D1C181CEF\n\nCOMPONENTS:\n\n       Time: 2019-02-14 23:32:57 -0800 PST\n  Timestamp: 150215977\n    Payload: 7C4C2B9274FAA52D0083816D1C181CEF\n```\n\n## Performance\n\nA very rough performance profile for generating KSUIDs was run on a MacBook Pro with a 3.1 GHz Intel Core i7 and 16 GB 2133 MHz LPDDR3 RAM.\n\n```java\npublic static void main(final String[] args) {\n    final KsuidGenerator generator = new KsuidGenerator(new SecureRandom());\n    IntStream.range(0, 100).forEach(i -\u003e generator.newKsuid()); // prime the random\n\n    IntStream.iterate(1000, operand -\u003e operand * 10)\n             .limit(5)\n             .forEach(count -\u003e {\n                 final long start = System.nanoTime();\n                 IntStream.range(0, count).forEach(i -\u003e generator.newKsuid());\n                 final long duration = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS);\n                 System.out.println(String.format(\"%,d in %,d ms. rate = %,d/ms\", count, duration, count / duration));\n             });\n}\n```\nThe output from the code block above is\n```\n1,000 in 14 ms. rate = 71/ms\n10,000 in 32 ms. rate = 312/ms\n100,000 in 95 ms. rate = 1,052/ms\n1,000,000 in 881 ms. rate = 1,135/ms\n10,000,000 in 6,665 ms. rate = 1,500/ms\n```\n\n## License\nThis library is Open Source software released under the [MIT license](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["分布式开发"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksuid%2Fksuid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksuid%2Fksuid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksuid%2Fksuid/lists"}