简体   繁体   中英

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 位,以生成用于加密的密钥。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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