无序的字符串集良好的哈希功能?

发布于 2025-02-11 23:58:25 字数 290 浏览 2 评论 0原文

是否有多个无序字符串集的方法,其中字符串元素相同。 例如:

set1 = [“ AB3567CD”,“ 123”,“ 789012”]

set2 = [“ 789012”,“ AB3567CD”,“ 123”,“ 123”]

set3 = [“ 123”,“ 789012”,“ AB3567CD”]

和哈希这些集合返回相同的结果而无需对其进行排序。

有这样的哈希功能吗?

Is there a method for multiple unordered string sets, in which the string elements are the same.
for example:

set1 = [ "ab3567cd", "123", "789012" ]

set2 = [ "789012", "ab3567cd", "123" ]

set3 = [ "123", "789012", "ab3567cd" ]

And hash these sets return the same result without sorting them.

Is there such a hash function?

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

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

发布评论

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

评论(1

慢慢从新开始 2025-02-18 23:58:25

如果不整理它们的位置,您将始终获得不同的位置。

This are always different strings:

ab3567cd 123 789012

789012 ab3567cd 123

123 ab3567cd 789012

什么是哈希算法?它如何工作?

文件如何工作?

更新:

有两种解决方案,但是如果这是正确的方法,我现在不现在。

这只是一个逻辑示例,

  1. 则可能不是正确的函数/计数方式!解决方案

如果我用正确的函数计算集合的值,

set1 = [“ ab3567cd”,“ 123”,“ 789012”]

计数:

 "ab3567cd" (+ or *) "123" (+ or *) "789012" = RESULT_VALUE

比哈希相比,result_value的set1,set2,set2和set3始终将获得相同的哈希值。

RESULT_HASH = HASH(RESULT_VALUE)
  1. 解决方案

set1 = [“ AB3567CD”,“ 123”,“ 789012”]

create hash1 from "ab3567cd"

create hash2 from "123"

create hash3 from "789012"

计数:

hash1 (+ or *) hash2 (+ or *) hash3 = RESULT_VALUE

比HASH result_value始终获得SET1,SET1,SET2和SET3的HASH值。

RESULT_HASH = HASH(RESULT_VALUE)

这个逻辑示例与所有可以哈希的语言一起使用。

Without sorting them to have the same position you will get always different hashes.

This are always different strings:

ab3567cd 123 789012

789012 ab3567cd 123

123 ab3567cd 789012

Do identical strings always have the same SHA-256 value?

What is a Hashing Algorithm and How Does it Work?

How does file hashing works?

UPDATE:

There are two solutions, but i don't now if this is the right way.

This is only an logical example, it maybe not the right function/count way!

  1. Solution

If i count the values of the set, with the right function.

set1 = [ "ab3567cd", "123", "789012" ]

count:

 "ab3567cd" (+ or *) "123" (+ or *) "789012" = RESULT_VALUE

Than you hash the RESULT_VALUE you will get always the same hash value for set1, set2 and set3.

RESULT_HASH = HASH(RESULT_VALUE)
  1. Solution

set1 = [ "ab3567cd", "123", "789012" ]

create hash1 from "ab3567cd"

create hash2 from "123"

create hash3 from "789012"

Count:

hash1 (+ or *) hash2 (+ or *) hash3 = RESULT_VALUE

Than you hash the RESULT_VALUE you will get always the same hash value for set1, set2 and set3.

RESULT_HASH = HASH(RESULT_VALUE)

This logical example works with all languages that can hash.

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