Extract crypto algorithm field and add utility functions

Password field of a user in /etc/shadow contains 3 parts:
[Crypt algorithm, Salt, encrypted password]

Example: A value of "1" in crypt algorithm maps to MD5

Need to use the same crypt algorithm that is already used
before when the new password is to be updated.

Change-Id: Ib7d8e0ad6f3bcce30f5c2be89b4e033230c07bf4
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
3 files changed