使用 Base64 编码作为检测更改的机制

发布于 2024-08-25 17:08:20 字数 177 浏览 4 评论 0 原文

是否可以通过检测对象的base64编码的变化来检测对象的变化程度。

假设我将文档附件发送给多个用户,每个用户都对其进行了更改并通过电子邮件发回给我,我可以使用原始 Base64 和接收到的 Base64 之间的字符串距离来检测哪个版本的更改最多。这是一个有效的指标吗?

如果没有,是否还有其他指标来量化增量?

Is it possible to detect changes in the base64 encoding of an object to detect the degree of changes in the object.

Suppose I send a document attachment to several users and each makes changes to it and emails back to me, can I use the string distance between original base64 and the received base64s to detect which version has the most changes. Would that be a valid metric?

If not, would there be any other metrics to quantify the deltas?

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

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

发布评论

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

评论(4

Saygoodbye 2024-09-01 17:08:20

这完全取决于您编码的文档的类型。如果它是一个文本文件,那么当然,base64 编码的差异可能与实际更改相同。但是,您可能有一种文件格式,其中内容的更改实际上会产生完全不同的二进制文件。 ZIP 文件就是一个例子。

That would depend entirely on the type of the document you had encoded. If it was a text file, then sure, the base64 encoded difference are probably on a par with the actual changes. However, you may have a format of a file where changes to the contents effectively produce a completely different binary file. An example of this would be a ZIP file.

王权女流氓 2024-09-01 17:08:20

您应该执行与 diff 相同的操作。然后例如对差异字段大小进行度量。

you should do the same that diff does. Then for example do the metrics on diff fiel size.

风柔一江水 2024-09-01 17:08:20

从理论上讲,是的,如果进行智能差异(检测插入、删除和修改)。

实际上,不会,除非文档绝对是纯文本。二进制格式无法进行有意义的比较。

In theory, yes, if do a smart diff (detecting inserts, deletions, and modifications).

In practice, no, unless the documents are absolutely plain text. Binary formats can't be meaningfully diff'd.

丑丑阿 2024-09-01 17:08:20

Base64 将 3x8 位值组打包为 4x6。如果将一个 8 位值更改一位位,则只会影响 6 位值中的一个。如果更改两位,则大约有 5/12 的机会达到其他 6 位值之一。所以如果你计算位数,它是完全等价的;否则,您将根据您使用的指标引入噪音。

Base64 packs groups of 3x8 bit values into 4x6. If you change one 8 bit value by one bit, then you'll impact only one of the 6 bit values. If you change by two bits, then you have about a 5/12 chance of hitting one of the other 6 bit values. So if you're counting bits, it is entirely equivalent; otherwise, you will introduce noise depending on the metric you use.

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