当前位置: 动力学知识库 > 问答 > 编程问答 >

c - Crypt type identification /etc/shadow

问题描述:

I know that the password field in /etc/shadow is prefixed with ${number}$ if it is not simply DES encrypted. What I am not able to find is a table that correlates the type of encryption to a given number.

For instance, $1$ would indicate MD5. Its the rest that escape me (i.e. SHA1, SHA256, Twofish, Blowfish, etc)

I've gone through the source to passwd and chpasswd as well as glib, but I'm not finding what I'm looking for.

Would someone mind sharing a link to a web page, or even a clue as to where In glib I might find such a table? I need to progmatically update passwords from within a program without using system() or exec*() calls. I'd like to write original code because I want to keep a uniform 3 clause BSD license and full copyright over my code.

Forgive me if this is a duplicate. I found lots of questions regarding how to parse /etc/shadow, but none that specifically ask how to identify the encryption type of the second field.

Edit:

For reference, here is the announcement from the discussion group that moved forward implementing SHA (over DES) with support for BSD Blowfish.

网友答案:

The crypt(3) man page describes it in the NOTES section.

分享给朋友:
您可能感兴趣的文章:
随机阅读: