+--- Retrieve the current user password hash.
+-- @param username String containing the username to retrieve the password for
+-- @return String containing the hash or nil if no password is set.
+function user.getpasswd(username)
+ local pwe = nixio.getsp and nixio.getsp(username) or nixio.getpw(username)
+ local pwh = pwe and (pwe.pwdp or pwe.passwd)
+ if not pwh or #pwh < 1 or pwh == "!" or pwh == "x" then
+ return nil
+ else
+ return pwh
+ end
+end
+