关于.net中的哈希码 [英] regarding hashcode in .net

查看:97
本文介绍了关于.net中的哈希码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了问题,我需要生成一个长度为5个字符的哈希码
但输入的是10位数字.哈希码应该是唯一的.

i have a problem, i need to generate a hash code of length 5 characters
but the input is 10 digit number. The hash code should be unique .
if any one can kindly post a solution that would be great.

推荐答案

一个可能的解决方案是将每对数字转换为一个字符.由于您可以选择100个字符,因此最终会使用字母,数字和标点符号.不包含这些字符,就无法对每10位数字进行唯一的5个字符的散列,那里的字符就不够.
One possible solution is to take each pair of numbers and turn it into a single character. As you''ll have 100 characters to choose from, you''ll end up using letters, numbers, and punctuation marks. There''s no way to make a unique 5 character hash for every 10 digit number without including those characters, there''s just not enough characters there.


这篇关于关于.net中的哈希码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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