良好的跨平台哈希函数\算法 [英] A good cross platform hash function\algorithm

查看:113
本文介绍了良好的跨平台哈希函数\算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要一个好的哈希函数(用于字符串),该函数将为不同平台上的特定字符串产生相同的哈希值,

我的应用调用了一个服务器场和一个银行"服务器,
每个服务器都会为字符串生成哈希密钥",而银行将存储密钥.
服务器稍后可能会询问银行,银行中是否存在特定的密钥[哈希值],如果存在,则执行SomeThings()等.

因此,散列函数散列在银行服务器和服务器场中的每台服务器(以及偶尔作为客户端连接并以与服务器场中的服务器类似的方式运行的PC)上产生相同的值.

**所有操作系统均为Windows(2k8_R2或Win7)64位

想法:
- SHA-2 GetHashCode() 或其他一些现成的标准是否适用于我吗?
-为了克服跨平台问题,我是否必须实现自己的哈希函数?如果是这样,那么对一个好的建议.


谢谢你,
Edo

Hey all,

I need a good hash function (for strings) that will produce the same hash value for a specific string on different platforms,

My app invovles a server farm, and a "bank" server,
Each server produces hash "keys" for strings and the bank stores the keys.
The Servers may later ask the bank if a specific key [hash value] exists in the bank and if so, do SomeThings() etc.

So the hash function hash to produce the same values on the bank server and on each of the servers on the farm (as well as PC who occasionally connect as clients and operate in a similar way to the servers on the farm.)

** All OS are windows (2k8_R2 or Win7) 64 bit

Thoughts:
- Will SHA-2, GetHashCode() or some other off-the-shelf standard, work well for me?
- Do I have to implement my own hash function in order to overcome the cross platform issue? if so, any recomendation for a good one.


Thanks a bunch,
Edo

推荐答案

.NET中的内置类怎么样:
http://msdn.microsoft.com/en-us/library/system. security.cryptography.rsacryptoserviceprovider.aspx [ ^ ]
How about the build in class in .NET:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.aspx[^]


这篇关于良好的跨平台哈希函数\算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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