Skip to content

Instantly share code, notes, and snippets.

@AlexAtkinson
Last active October 11, 2022 20:21
Show Gist options
  • Save AlexAtkinson/a7a8bd17e0b0d6b4d89f836e6f81d421 to your computer and use it in GitHub Desktop.
Save AlexAtkinson/a7a8bd17e0b0d6b4d89f836e6f81d421 to your computer and use it in GitHub Desktop.
NIST Randomness Beacon Example
#!/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