1

Just like the title says, is there a security difference in the randomness of a random string encoded as a base64 or hex string?

dkimot
  • 2,239
  • 4
  • 17
  • 25
  • Hex is just another way of saying `base16` - does that help? – blurfus Nov 29 '18 at 23:05
  • Possible duplicate of [Base64 vs HEX for sending binary content over the internet in XML doc](https://stackoverflow.com/questions/3183841/base64-vs-hex-for-sending-binary-content-over-the-internet-in-xml-doc) – blurfus Nov 29 '18 at 23:06
  • maybe you mean obfuscation, ie protect from gentle browsing of files, not safe from hacking. For obfuxation they are about the same, HTTP basic uses base64 (that might be a recommendation to use or avoid, just FYI) – pm100 Nov 29 '18 at 23:32

2 Answers2

2

Formally pure random string are the real security. Encoding is only a matter of storing this bytes.

See :

  • ascii (base 85) : password
  • base64 (base 64) : cGFzc3dvcmQ=
  • Hex (base 16): 70617373776F7264
  • Binary (base 2) : 0111000001100001011100110111001101110111011011110111001001100100

All are saying password. No security in encoding (except for human eyes).

pm100
  • 48,078
  • 23
  • 82
  • 145
Bertrand
  • 1,840
  • 14
  • 22
0

Both Hex and Base-64 strings are treated as encoded data not as secured data. Data can be easily decoded back to original form. Aim of encoding is to transform the data so that data is compatible and can be consumed by different systems.

In terms of choosing between Hex and Base-64, Go with Base-64 as it consumes less space in comparison with Hex.

Rasik Jain
  • 1,026
  • 6
  • 14