base64编码安全的文件名? [英] Base64 Encoding safe for filenames?

查看:2165
本文介绍了base64编码安全的文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时的Base64编码的安全使用在Windows和Linux系统上的文件名?从我的研究,我发现与替换输出字符串的所有/字符 - 或_应解决任何问题。

任何人都可以提供这方面的信息?

目前在Java中,我使用code以下peice的:

 消息摘要md5Digest = MessageDigest.getInstance(MD5);
    md5Digest.reset();
    md5Digest.update(plainText.getBytes());    字节[] =消化md5Digest.digest();    BASE64En codeR EN codeR =新BASE64En codeR();
    哈希= EN coder.en code(摘要);
    hash.replace('/','_');


解决方案

我会用Base32在这种情况下 - 你会得到一个名字有点长,但Base32 EN codeD值是情况insensetive环境安全(FAT / Win32的NTFS访问),以及使用的URI。

不幸的是,平时有没有内置此编码在框架的支持。在另一方面code是realitvely简单写自己或在网上找到。

http://en.wikipedia.org/wiki/Base32

Is Base64 encoding safe to use for filenames on windows and linux systems? From my research I have found replacing all "/" characters of the output string with "-" or "_" should resolve any issues.

Can anyone provide more details on this?

Currently in Java I am using the following peice of code:

    MessageDigest md5Digest = MessageDigest.getInstance("MD5");
    md5Digest.reset();
    md5Digest.update(plainText.getBytes());

    byte[] digest = md5Digest.digest();

    BASE64Encoder encoder = new BASE64Encoder();
    hash = encoder.encode(digest);
    hash.replace('/','_');

解决方案

I would use Base32 in this case - you'll get names a bit longer, but Base32 encoded values are safe for case insensetive environment (FAT/Win32 NTFS access) as well for using as Uri.

Unfortunately there is usually no built-in support for this encoding in frameworks. On other hand code is realitvely simple to write yourself or find online.

http://en.wikipedia.org/wiki/Base32.

这篇关于base64编码安全的文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆