简体   繁体   English

C crypt() 函数,不同的密码,相同的哈希

[英]C crypt() function, different passwords, same hash

The below code is producing the same hash for different but similar words .下面的代码为不同但相似的词生成相同的哈希值 Does this mean that the user can type a similar password and get the access?这是否意味着用户可以输入类似的密码并获得访问权限?

hi  = crypt("academics", "50");
hii = crypt("academicians", "50");

printf ("academics : %s\n", hi);
printf ("academicians : %s\n", hii);

printf ("string compare : %d\n", strcmp(hi,hii));

output :输出 :

academics      : 50IlqAh9rdDJo
academicians   : 50IlqAh9rdDJo
string compare : 0

它们的crypt函数使用您作为参数传递的密钥的前八个字符中每个字符的最低 7 位,以生成用于加密的密钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM