Open Source

Puff: Your Random Data Generator

Puff is a command-line tool for quickly generating random values in formats like UUID, hexadecimal, base64, and binary blobs.

Installation


$ brew install chronohq/tap/puff

View the full installation guide on GitHub

Hexadecimal Encoding


Generate hexadecimal values from bytes provided by a cryptographically secure RNG. These values are useful for security applications and other use cases requiring unpredictable uniformly distributed random data.

  • Generate hexadecimal values from 16 random bytes

    $ puff -n 3
    24d3391439334b66937612b7052deaa7
    dacb60db0af3c2d72de85382e887e235
    8345093802ecaa8ec4a0f91f09216279
  • Generate hexadecimal values from 32 random bytes

    $ puff -n 3 --bytes 32
    f9322c45ea83938ca56729f326bb41999807bfa5dbeac3bfc8d6155076478a3b
    7aacea8da69f0bb4575aa4733b4eb0b510316528bf3eeed7e74238eb5688e1e6
    87bbf57a1aa438a4bb77cb24be64740a338f2c767d38c77df4b3c0238440ff9d

UUID (Universally Unique Identifier)


Puff supports UUID version 4 and version 7. Version 4 UUIDs are randomly generated and ideal for general-purpose unique identifiers. Version 7 UUIDs are time-ordered, making them suitable for applications that require sortable identifiers.

UUID Version 4

  • Generate multiple UUIDv4 values

    $ puff uuid -n 3
    8a67426f-4f9d-425f-9a16-d39ea6a6167a
    9a44e7b2-a56b-4dea-af7e-28ebb4d35282
    cff38d7f-32d0-41ac-9e16-fcd398f90507
  • Generate multiple UUIDv4 values without dashes

    $ puff uuid -n 3 --compact
    160680f8224f4921bd503231cc9e30c5
    ceea7e9c03334f6896cd3689046c3c71
    24ade2d7114948229b0cc142e84bb8ee

UUID Version 7

  • Generate multiple UUIDv7 values

    $ puff uuid --v 7 -n 3
    009eab7b-0940-7ecd-9b4f-738363b13ba0
    009eab7b-0940-7f0f-a709-c6ad71186d20
    009eab7b-0940-7f17-9239-63faa4d055f8
  • Generate UUIDv7 values using the given ISO8601 datetime

    $ puff uuid --v 7 -n 3 --time "1991-08-06T12:30:00.000Z"
    009eab7b-0940-7376-b1b5-3fdb57580df8
    009eab7b-0940-7e15-847f-32a88ffd4a9d
    009eab7b-0940-7e2c-9763-7d9e5e6cdf8a
  • Generate UUIDv7 values using the given Unix timestamp

    $ puff uuid -v 7 -n 3 --time 681481800
    009eab7b-0940-79b0-b000-9b3ee59bc344
    009eab7b-0940-79fe-96a4-96953f29de1c
    009eab7b-0940-7a0e-b28f-ba65d364c6eb
  • Add custom suffix to generated values

    $ puff uuid -v 7 -n 3 --compact --suffix ".png"
    009eab7b-0940-79b0-b000-9b3ee59bc344.png
    009eab7b-0940-79fe-96a4-96953f29de1c.png
    009eab7b-0940-7a0e-b28f-ba65d364c6eb.png

Base64 Encoding


Generate base64-encoded values from bytes provided by a cryptographically secure RNG. Base64 encoding provides a more compact representation than hexadecimal, making it ideal for URL parameters, file names, cache keys, temporary identifiers, and use cases where string length matters.

  • Generate base64-encoded values from 16 random bytes

    $ puff base64 -n 3
    ahm8G8R6LIs1+84kC8iDqA==
    rbJ+B/XReJtH/yS52Evx0w==
    COlun4FMOMfTRVp+cW/5FQ==
  • Generate URL-safe base64-encoded values from 32 random bytes

    $ puff base64 -n 3 --bytes 32 --url-safe
    w21guyZfy6iTFjjkcXc-x-vULmwaCBciKftTDKrhga0
    zxq6tXi6zkZnTbLy-icFYH8w8a81QoJ0vl-UY4YLbOk
    qzaKwybim-bs_UsnabYIc6elDsbsgtmfiQHnRkxSHK8

Binary Data


Generate binary data from bytes provided by a cryptographically secure RNG. Binary output is ideal for test data, file operations, and use cases requiring raw random data without encoding overhead.

  • Create a binary file containing 1MB of random bytes (default)

    $ puff binary -o /tmp/puff-1mb.bin
  • Create a binary file containing 10MB of random bytes

    $ puff binary --bytes 10485760 -o /tmp/puff-10mb.bin

Command Reference


NAME:
   puff - Generate random values in different formats

USAGE:
   puff [global options] command [command options]

VERSION:
   0.6.1

COMMANDS:
   hex      Generate random hexadecimal strings
   uuid     Generate UUID strings (default: UUIDv4)
   base64   Generate base64 strings (default: 16-bytes)
   binary   Generate a random binary blob
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --bytes value, -b value      length of the source data in bytes (default: 16)
   --num value, -n value        number of hex strings to generate (default: 1)
   --delimiter value, -d value  delimiter between values (default: "\n")
   --suffix value, -s value     optional value to append to the values
   --help, -h                   show help
   --version, -v                print the version

Blog Articles


License


Puff is open source software released under the MIT License. You're free to use, modify, and distribute it for any purpose, including commercial applications. Contributions are welcome. Visit the GitHub repository to report issues, suggest features, or submit pull requests.