I m 寻找一种散射功能,我可以用来向连接我们网络的装置提供统一的独一无二的识别器,这些装置要么使用全球移动式电解器,要么是使用异构体连接。
因此,对于任何特定装置,我要么拥有一个,要么拥有一个硬-coded,我可以用来生成 has。
我先是研究过去几小时的散射功能,读一下我可能希望使用的不同的非加密和加密。 我的重点是对业绩的低col,因为经常无法计算 has。
我的前线是MD5、FNV-1a、MurmurHash2、Hsieh和DJB。
无论用什么洗衣,都必须在C实施,并且将使用小型加工器的微型控制器。
我知道,为你们的需要选择良好的洗衣功能的陷阱,是知道你会再提供何种投入。
The reason I m asking this question is that the idea popped into my head that both IMEI and MAC have finite lengths and ranges, so perhaps there exists a fairly simple hash function that can cover the full sets of both and not have collisions. (Thus, a perfect hash function)
长期监测指数为15位精度数(12-13位高分数)和6位中位数。 我不认为你在两组投入数字之间会发生碰撞,但认为如果错的话,我可以自由纠正。 如果你能做些什么来防止这种情况? 将一些种子添加到其中之一?
Am I on the right track? Is finding perfect hash function for these combined sets possible?
Thanks!
Update
Thanks for the answers and comments. I ended up using the identity function ;) as my hash function, and then also using a mask since there is potential overlap across the sets of numbers.
IMEI, IMEISV, and MAC will all fit in 6.5 bytes or less, so I am storing my values in 7 bytes and then doing a bitwise OR on the first byte with a mask based on which set the number comes from, to ensure they are unique across all sets.