对文件进行编码

发布于 2024-10-25 02:46:09 字数 255 浏览 1 评论 0原文

这个问题解释起来有点棘手。我想创建一个文件,比如说 .test 文件。现在,创建和编写它非常容易,但我想对信息进行编码,这样我只能用测试程序来解释信息。 因此,该测试程序将能够创建和读取 .test 文件。关键是,只有该程序可以读取该文件,您无法仅通过使用记事本打开该文件来真正解释该信息,因为它不可读。

我只是想要一些关于如何实现这一目标的指导。如果您确实不明白我刚才所说的内容,我想知道如何创建类似于 BitTorrent 中使用的 Bencode 的东西或者它是如何工作的。

This one is a little tricky to explain. I would like to create a file, lets say, a .test file. Now, this is ridiculously easy to create and write, but I would like to encode the information so I could only interpret the information with the Test Program.
So, this Test Program would be able to create and read the .test files. And the point is that, only that program can read the file, you can't really interpret the information just by opening the file with Notepad as it wouldn't be read-able.

I would just like some direction as to how I could accomplish this. If you really didn't understand what I just said, I would like to know how to create or how does it work something similar to Bencode used in BitTorrent.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

原来是傀儡 2024-11-01 02:46:09

如果您确实担心文件的安全性,可以对其内容进行加密。有几个第三方库,例如 ezPyCryptopyDes 使其易于实施。

If you're really worried about the security of the file, you could encrypt its content. There are several third party libraries such as ezPyCrypto and pyDes that make it simple to implement.

宁愿没拥抱 2024-11-01 02:46:09

如果您想要一个非常简单的版本,请使用 python 的 base64 模块。该文件将无法再在记事本中打开,但如果您知道自己在做什么,则可以轻松解码。

如果您确实想阻止任何其他程序对其进行编码:请不要这样做。你可能会花费很多精力,但你真正能完成的唯一一件事就是惹恼想要数据的人。

If you want a really simply version, use python's base64 module. The file won't be recognizable opening in notepad anymore, but it'll be easy to decode if you know what you are doing.

If you actually want to prevent any other program from being able to encode it: don't. You can spend a lot of effort and the only thing you can really accomplish is annoying the person who wants the data.

無處可尋 2024-11-01 02:46:09

您需要确定是要编码还是加密
http://danielmiessler.com/study/encoding_vs_encryption/

You need to determine whether you want en-coding or en-cryption:
http://danielmiessler.com/study/encoding_vs_encryption/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文