If I use openssl to generate some random data (for a keyfile, for example):

openssl rand -hex 2048 >/tmp/file

Is this 4097 bits (or bytes?) of entropy?

-rw-rw-r-- 1 username username 4097 Oct 30 20:01 /tmp/file
  • It's 2048 bytes, hex-encoded (ie a byte = 69 in decimal will be printed as '45') and followed by a newline (2048 * 2 + 1). If you want to raw bytes, don't use the -hex option ;-) – mosvy Oct 31 '18 at 9:55

Is this 4097 bits (or bytes?) of entropy?

Neither. Entropy is a property of how the random data was generated (see, e.g., this Crypto.SE post), not how much of it was generated. If openssl rand could generate data with x bits of entropy, that would still be x bits of entropy irrespective of whether you told it to output 1 bit or 1 TB.

A detailed discussion of entropy would likely be off-topic here. Maybe ask on Cryptography SE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.