How to represent 32 bytes of binary data in the smallest possible way to print

I have a sha256 hash file of some data, which is the product identifier for the registration system. I want to provide this information to the end user, and I want it to contain only printable characters (preferably az, AZ, and 0-9). I tried regular hex and base64, but they both give very long results that are not satisfactory. I want to present the data as little as possible in the format of alphanumeric characters, but without losing integrity. Please note that data does not need to be converted back, so it can be a one-way process if security is not lost.

I work on C.

Thanks in advance for your help!

Yours faithfully,

Philip Bennefall

+3
source share
2 answers

32 bytes of data will be very difficult to provide meaningfully to a user in an environment that does not support cut / paste, however you imagine it.

Reduce the amount of data you use for the product identifier, and you can use Base-64 and friends.

+3
source

If Base64 is not suitable for your 32 bytes, MD5 - up to 16 bytes - shazam, now it is half as much.

Why, yes, it is absurd to hash a 32-byte hash of up to 16 bytes, but this is basically what you are asking to do, be it 16 or any other number of bytes. You will lose information.

Or just use MD5 to start as it has a smaller hash.

, ? - . , 3 .

+2

All Articles