{"id":23714391,"url":"https://github.com/gpakosz/uuid4","last_synced_at":"2025-09-03T18:32:07.838Z","repository":{"id":42462876,"uuid":"163958146","full_name":"gpakosz/uuid4","owner":"gpakosz","description":"UUID v4 generation in C","archived":false,"fork":false,"pushed_at":"2022-04-04T21:25:47.000Z","size":17,"stargazers_count":65,"open_issues_count":1,"forks_count":11,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-01T20:38:52.988Z","etag":null,"topics":["c","cpp","library","tiny","uuid","uuid4"],"latest_commit_sha":null,"homepage":"","language":"C","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/gpakosz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"LICENSE.MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"gpakosz"}},"created_at":"2019-01-03T10:26:50.000Z","updated_at":"2024-04-21T12:18:19.000Z","dependencies_parsed_at":"2022-09-14T00:30:29.328Z","dependency_job_id":null,"html_url":"https://github.com/gpakosz/uuid4","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpakosz%2Fuuid4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpakosz%2Fuuid4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpakosz%2Fuuid4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpakosz%2Fuuid4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gpakosz","download_url":"https://codeload.github.com/gpakosz/uuid4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231908230,"owners_count":18444268,"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":["c","cpp","library","tiny","uuid","uuid4"],"created_at":"2024-12-30T20:19:25.004Z","updated_at":"2024-12-30T20:19:25.509Z","avatar_url":"https://github.com/gpakosz.png","language":"C","funding_links":["https://github.com/sponsors/gpakosz"],"categories":[],"sub_categories":[],"readme":"# UUID4\n\nA drop-in two files library to generate version 4 UUIDs.\n\n⚠ The underlying PRNG is SplitMix which makes UUIDs produced by this library\ntrivially predictable. But if you're willing to generate secure \"tokens\", that's\nnot what UUIDs are made for anyway 🤷‍♂️\n\nThe statistical properties of the generated UUIDs have been tested with\n[PractRand] and [TestU01] 🎲\n\nThis implementation has been used in production for years without any reported\ndefect so far 🤞\n\nSupported platforms:\n\n- Windows\n- Linux\n- Mac\n- iOS\n- Android\n\nJust drop `uuid4.h` and `uuid4.c` into your build and get started. (see also\n[customizing compilation])\n\n[customizing compilation]: #customizing-compilation\n[PractRand]: http://pracrand.sourceforge.net/PractRand.txt\n[TestU01]: http://simul.iro.umontreal.ca/testu01/tu01.html\n\n--------------------------------------------------------------------------------\n\n## Usage\n\n- `uuid4_seed()` seeds the version 4 UUID generator.\n- `uuid4_gen()` generates a version 4 UUID.\n- `uuid4_to_s()` converts a version 4 UUID into a string.\n\nExample usage:\n\n```\n#include \u003cstdio.h\u003e\n#include \u003cuuid4.h\u003e\n\nint main()\n{\n  UUID4_STATE_T state;\n  UUID4_T uuid;\n\n  uuid4_seed(\u0026state);\n  uuid4_gen(\u0026state, \u0026uuid);\n\n  char buffer[UUID4_STR_BUFFER_SIZE];\n  if (!uuid4_to_s(uuid, buffer, sizeof(buffer)))\n    exit(EXIT_FAILURE);\n\n  printf(\"%s\\n\", buffer);\n\n  return EXIT_SUCCESS;\n}\n```\n\n--------------------------------------------------------------------------------\n\n## Customizing compilation\n\nYou can customize the library's behavior by defining the following macros:\n\n- `UUID4_FUNCSPEC`\n- `UUID4_PREFIX`\n- `UUID4_ASSERT`\n\n## Compiling for Windows\n\nThere is a Visual Studio 2015 solution in the `_win-vs14/` folder.\n\n## Compiling for Linux or Mac\n\nThere is a GNU Make 3.81 `MakeFile` in the `_gnu-make/` folder:\n\n    $ make -j -C _gnu-make/\n\n## Compiling for Mac\n\nSee above if you want to compile from command line. Otherwise there is an Xcode\nproject located in the `_mac-xcode/` folder.\n\n## Compiling for iOS\n\nThere is an Xcode project located in the `_ios-xcode/` folder.\n\nIf you prefer compiling from command line and deploying to a jailbroken device\nthrough SSH, use:\n\n    $ make -j -C _gnu-make/ platform=ios architecture=arm64 CC=\"$(xcrun --sdk iphoneos --find clang) -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch arm64\" postbuild=\"codesign -s 'iPhone Developer'\"\n\n## Compiling for Android\n\nYou will have to install the Android NDK, and point the `$NDK_ROOT` environment\nvariable to the NDK path: e.g. `export NDK_ROOT=/opt/android-ndk` (without a\ntrailing `/` character).\n\nNext, the easy way is to make a standalone Android toolchain with the following\ncommand:\n\n    $ $NDK_ROOT/build/tools/make_standalone_toolchain.py --arch=arm64 --api 21 --install-dir=/tmp/android-toolchain\n\nNow you can compile the example by running:\n\n    $ make -j -C _gnu-make/ platform=android architecture=arm64 CC=/tmp/android-toolchain/bin/aarch64-linux-android-gcc CXX=/tmp/android-toolchain/bin/aarch64-linux-android-g++\n\n--------------------------------------------------------------------------------\n\nIf you find this library useful and decide to use it in your own projects please\ndrop me a line [@gpakosz].\n\n[@gpakosz]: https://twitter.com/gpakosz\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpakosz%2Fuuid4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgpakosz%2Fuuid4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpakosz%2Fuuid4/lists"}