I need to generate a random 128-bit number and get it's binary representation, b64-encoded.
Sample:
vagrant@ubuntu1804:~$ consul keygen
TUlzi8BWwPQR1zyjR1TiAQ==
in it's b64 decoded form:
vagrant@ubuntu1804:~$ consul keygen | base64 -d|hexdump -C
00000000 46 b8 72 4b ce 9a 2a 14 09 7b 16 51 99 1b 39 e0 |F�rK�.*..{.Q..9�|
00000010
I can generate the large number with random
filter:
{{ 340282366920938463463374607431768211456 | random }}
I know I can encode it with b64encode
, but have no idea how to convert the number to the binary format.