How to generate dummy device IDs?

If we take the bytes of a SHA256 output - and not any character representation or base conversions - all of the documentation checks out:

# echo "foo" | openssl dgst -binary -sha256 | base32
WW5Z3AAUUD43DVQ6EHTZNV4NZTPRGUXSHTJSQEXUQUFYPCXESRGA====

Remove the padding as instructed by the documentation and you get exactly 52 base32 characters as foretold by the docs.

Now, compute 4 check digits (each covering 1/4 of the 52 characters) and place them according to the following scheme (see this post [v0.9.0] New node ID format, also linked in the docs):

aaaaaaa-aaaaaaA-bbbbbbb-bbbbbbB-ccccccc-ccccccC-ddddddd-ddddddD

For our example, we get (check digits replaced by ?):

WW5Z3AA-UUD43D?-VQ6EHTZ-NV4NZT?-PRGUXSH-TJSQEX?-UQUFYPC-XESRGA?

2 Likes