Restrict RAND to producing 63 random bits
rgm at htt-consult.com
Thu Jul 20 21:56:20 UTC 2023
I kind of like that. I was thinking how to use a mask like you have,
but I just don't have the skills in that direction to figure it out.
I may document both ways.
On 7/20/23 17:39, James wrote:
> An alternative using openssl
> $ printf "%016X\n" $((16#$(openssl rand -hex 8) & 0x7fffffffffffffff))
>> To get the leading zeros so it will generate an 8-byte serial number,
>> I added:
>> printf "%016X\n" $(shuf -rn 1 -i 1-9223372036854775807
>> an example output is:
>> I had to run it a couple dozen times before it generated a small
>> enough value to need to pad it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the openssl-users