Skip to content

louisraetz/nuid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nuid

a uuid v4 generator written in arm64 assembly.

what is this

generates RFC 4122 compliant uuid v4s using /dev/urandom for entropy using just raw syscalls

built this as a qol tool for myself and to learn a bit assembly

requirements

  • apple silicon mac (m1/m2/m3/m4)
  • xcode command line tools

usage

make
./nuid

then enter how many uuids you want. thats it.

$ ./nuid
Enter number of UUIDs to generate: 3
a1b2c3d4-e5f6-4789-abcd-ef0123456789
deadbeef-cafe-4bab-8000-000000000001
12345678-90ab-4def-8123-456789abcdef

performance

its pretty fast

$ time (echo 100000 | ./nuid > /dev/null)
real    0m0.153s

how it works

  1. reads from /dev/urandom for 16 random bytes
  2. sets version bits (byte 6 high nibble = 0x4)
  3. sets variant bits (byte 8 = 10xxxxxx)
  4. formats to hex string with dashes
  5. prints it
  6. repeat

file structure

main.s      - entry point n main loop
constants.s - syscall nums, strings, buffers
io.s        - print/read/file ops
convert.s   - atoi for parsing input
uuid.s      - uuid formatting n version bits
Makefile    - build stuff

disclaimer

this is a hobby project. if you need production grade uuids maybe use something else.

About

CLI tool written in assembly for generating thousands of UUID's in nanoseconds

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors