Search code examples
elasticsearchencodingbase64

Why encode string with base64 if it can be easily decoded


There are algorithms for encoder which are impossible to hack and these encoder are used in applications like HTTPS for sending secure message over network. Base64 is very simple and can be easily decoded, I think encoding with base64 is as simple as sending raw data. Then why base64 encoding is used? For example Elasticsearch automatically generates id which is encoded with base64


Solution

  • Base64 is not used for security at all, it is used as a means of escaping special characters.

    see:

    https://security.stackexchange.com/questions/29916/why-does-http-basic-authentication-encode-the-username-and-password-with-base64

    What is the purpose of base 64 encoding and why it used in HTTP Basic Authentication?

    Why Base64 in Basic Authentication