Base64 Encoding safe for filenames?

后端 未结 6 1734
一生所求
一生所求 2020-12-28 14:01

Is Base64 encoding safe to use for filenames on Windows and Linux systems? From my research I have found that replacing all / characters of the result with

6条回答
  •  旧时难觅i
    2020-12-28 14:44

    Usually MD5 hashes (hashes in general) are represented as hexadecimal strings instead of Base64, which then only contain [a-f0-9]. Those names would be supported by all filesystems.

    If you really want to use Base64, your solution (replacing slashes) will not work correctly as Windows filesystems don't make a difference between 'A' and 'a'. Maybe you want to use Base32 instead? But mind that Base32 makes 8 bits out of 4, so it will be easier to just take the hexadecimal representation.

    In general, the following characters are not allowed in Windows and/or Linux: \ / : * ? " < > |

提交回复
热议问题