Skip to content

Instantly share code, notes, and snippets.

@AlexAtkinson
Last active January 28, 2026 04:05
Show Gist options
  • Select an option

  • Save AlexAtkinson/a7a8bd17e0b0d6b4d89f836e6f81d421 to your computer and use it in GitHub Desktop.

Select an option

Save AlexAtkinson/a7a8bd17e0b0d6b4d89f836e6f81d421 to your computer and use it in GitHub Desktop.
The League of Entropy (The WHAT!?)

Randomness Beacons

Randomness has been useful to society for thousands of years, but has become essential in the modern age. Applications range from games of chance, religious ritual, and lottery systems, to the cryptographic techniques that allow us to use the internet with any degree of privacy.

The following is a simple script that demonstrates NISTs randomness beacon.

#!/usr/bin/env bash
# nist-randomness-beacon-eg.sh
# --------------------------------------------------------------------------------
#
# Output:
#   Datetime: 2022-10-06T11:58:07
#   Previous: 29B7969259B18... 
#    Current: 97B0CAC685FD4...
#
# Resources:
#   - https://beacon.nist.gov/home
#   - https://csrc.nist.gov/projects/interoperable-randomness-beacons

# Print datetime
printf "%s\n" "Datetime: $(date +'%FT%H:%M:%S')"

# Get some randomness
#   Prints only the current and previous values
#   Execute a few times around 58-04s to witness the pulse iterate the values
curl -s https://beacon.nist.gov/beacon/2.0/pulse/last | jq -r '"Previous: \(.pulse.listValues[] | select(.type=="previous") | .value) \n Current: \(.pulse.outputValue)"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment