SAS中文论坛

标题: 请教一个hash的入门问题 [打印本页]

作者: shiyiming    时间: 2008-3-7 16:03
标题: 请教一个hash的入门问题
最近在看sas help 里面关于hash对内容,初学。
The hash object provides an efficient, convenient mechanism for quick data storage and retrieval. The hash object stores and retrieves data based on lookup keys.
请问这里的lookup keys 是什么意思? 以前好像也看到过lookup table ,也没弄明白。

请教了 呵呵!!
作者: shiyiming    时间: 2008-3-7 16:47
标题: Re: 请教一个hash的入门问题
hash 对象在很多地方都有,比如perl里边就有,像vb.net的Hashtable, collection, dictionary.
基本道理就是一对对的数值一一对应. 然后通过查询Key ,就会很快定位key所对应的item.
作者: shiyiming    时间: 2008-3-12 09:11
标题: Re: 请教一个hash的入门问题
期待大家的跟铁,把这个问题搞深入啊
作者: shiyiming    时间: 2008-3-14 12:17
标题: Re: 请教一个hash的入门问题
The following is captured from 维基百科:

散列函数(或散列算法)是一种从任何一种数据中创建小的数字“指纹”的方法。该函数将数据打乱混合,重新创建一个叫做散列值的指纹。散列值通常用来代表一个短的随机字母和数字组成的字符串。好的散列函数在输入域中很少出现散列冲突。在散列表和数据处理中,不抑制冲突来区别数据,会使得数据库记录更难找到。

Hash function is used to generate "finger print" most of the time.  Hash function can be any algorithm, but must guarantee different input, must generate different output (uniqueness).  MD5 is a good example.

Example of hash can be used as password storage.  The hash function itself is not reversible (You cannot provide an output to get the input), and thus the system does not know the original input.  Following is an example:

Password = "123456";
Hash(Password) will generate something like "D2AC55";

Where "D2AC55" will be stored at the system.  In future, when someone is asked to provide the password again, the system will do:
if (Hash(input_password) == "D2AC55")
then OK;
else WRONG_PASSWORD;

The system cannot generate "12345" by providing "D2AC55", and thus is quite safe.




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2