{"id":21203033,"url":"https://github.com/kvdpxne/forty2","last_synced_at":"2025-03-14T22:42:03.416Z","repository":{"id":223381256,"uuid":"756521047","full_name":"kvdpxne/forty2","owner":"kvdpxne","description":"A lightweight and versatile Java library designed to generate unique identifiers with customizable length and character sets.","archived":false,"fork":false,"pushed_at":"2024-06-01T20:10:16.000Z","size":127,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T15:13:21.788Z","etag":null,"topics":["java","java-library","library","unique-id","unique-id-generator"],"latest_commit_sha":null,"homepage":"","language":"Java","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/kvdpxne.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":"2024-02-12T20:19:25.000Z","updated_at":"2024-02-25T20:49:12.000Z","dependencies_parsed_at":"2024-03-02T16:54:00.379Z","dependency_job_id":null,"html_url":"https://github.com/kvdpxne/forty2","commit_stats":null,"previous_names":["kvdpxne/forty2"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvdpxne%2Fforty2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvdpxne%2Fforty2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvdpxne%2Fforty2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kvdpxne%2Fforty2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kvdpxne","download_url":"https://codeload.github.com/kvdpxne/forty2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658151,"owners_count":20326464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["java","java-library","library","unique-id","unique-id-generator"],"created_at":"2024-11-20T20:20:09.478Z","updated_at":"2025-03-14T22:42:03.068Z","avatar_url":"https://github.com/kvdpxne.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About\n\n**Forty2** is a lightweight and versatile **Java** library designed to generate\nunique identifiers with customizable length and character sets.\nOriginally based on the concept of [Nano ID](https://github.com/ai/nanoid),\nit provides a simple yet powerful solution for generating unique identifiers\ntailored to your specific needs.\n\n### Features\n\n- **Customizable**: Generate identifiers of any desired length and from a wide\n  range of characters, providing flexibility and adaptability to diverse\n  requirements.\n- **Universal Uniqueness**: Utilizes algorithms to ensure uniqueness across\n  generated identifiers, guaranteeing minimal collision probability.\n- **Easy Integration**: Simple setup and easy integration into your projects,\n  facilitating smooth adoption and usage.\n\n### 📝 Note\n\nIf you came here by accident and are **looking for a more efficient** way to\ngenerate unique identifiers than the natively built-in solution of\n``java.util.UUID``, please see\n[this repository](https://github.com/f4b6a3/tsid-creator).\n\n## Benchmark\n\n```text\nBenchmark                     Mode  Cnt     Score    Error   Units\nForty2_alphanumeric          thrpt   25  1259.872 ±  2.109  ops/ms\nForty2_all                   thrpt   25  1392.449 ±  4.583  ops/ms\nForty2_alphanumeric_size_21  thrpt   25  1070.119 ± 11.064  ops/ms\nForty2_all_size_21           thrpt   25  1104.755 ±  3.084  ops/ms\nForty2_create                thrpt   25  1261.872 ±  1.560  ops/ms\nUUID_randomUUID              thrpt   25  1509.737 ±  1.545  ops/ms\nUUID_randomUUID_toString     thrpt   25  1223.936 ±  6.679  ops/ms\n```\n\nNumber of threads used in this the benchmark: 4.  \nSystem: AMD Ryzen 5 2600, 16 GB RAM, Windows 10 22H2, JVM 21.\n\n## Installation\n\nBelow are the instructions for installing **Forty2** using\n[Gradle](https://gradle.org) with [JitPack](https://jitpack.io):\n\n### Gradle\n\n1. Open your `build.gradle` file.\n2. Add the [JitPack](https://jitpack.io) repository to your `repositories`\n   block:\n\n```groovy\nrepositories {\n  maven {\n    url = \"https://jitpack.io\"\n    content {\n      includeGroup(\"com.github.kvdpxne\")\n    }\n  }\n}\n```\n\n3. Add the **Forty2** dependency to your `dependencies` section:\n\n```groovy\ndependencies {\n  implementation(\"com.github.kvdpxne:forty2:\u003cVERSION\u003e\")\n}\n```\n\n4. Replace `\u003cVERSION\u003e` with the version of **Forty2** you want to use.\n\nNow, your project will fetch the **Forty2** dependency from\n[JitPack](https://jitpack.io) while excluding other repositories from the\ndependency search.\n\nFor more information about [JitPack](https://jitpack.io) and how it works,\nyou can refer to the [JitPack documentation](https://docs.jitpack.io).\n\n## Usage\n\nUsing **Forty2** is straightforward.\nAfter including it in your project's dependencies, you can start generating\nunique identifiers with ease.\n\n### Basic Usage\n\nHere's a simple example of how to generate an identifier with **Forty2**:\n\n```java\n// Generate a 14-character identifier using alphanumeric characters.\nvar alphanumeric = Forty2.alphanumeric();\n\n// Generate a 14-character identifier using all writable ASCII characters.\nvar all = Forty2.all();\n```\n\nUsing this method ensures optimized performance and safety in generating\nidentifiers.\n\n### Advanced Usage\n\nYou can customize the length and character set of the generated identifier\naccording to your specific requirements:\n\n```java\n// Generate a 21-character identifier using alphanumeric characters.\nvar alphanumeric = Forty2.alphanumeric(21);\n\n// Generate a 21-character identifier using all writable ASCII characters.\nvar all = Forty2.all(21);\n\n// Generate a 36-character identifier using specified characters.\nvar customized = Forty2.create(\"0123456789abcdef\", 36);\n```\n\n### 📝 Note\n\nFor security and performance reasons, it is recommended to review the character\nset used for generating identifiers and ensure that it meets your application's\nrequirements.\nAdditionally, consider implementing additional security measures if identifiers\nare used for sensitive operations.\n\n### ⚠️ Warning\n\nUsing the method with `_` prefix like `_create` is faster than the\nmethod without `_` prefix, but it does not perform parameter validation.\nTherefore, it should only be used if you are certain about the transmitted\nparameters.\n\nNow, you can integrate **Forty2** into your Java projects and leverage its\ncapabilities to generate unique identifiers efficiently.\n\n## License\n\nThis project is licensed under the **Apache License**, version **2.0**.\nSee the [LICENSE](https://github.com/kvdpxne/forty2/blob/master/LICENSE) file\nfor details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvdpxne%2Fforty2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkvdpxne%2Fforty2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkvdpxne%2Fforty2/lists"}