CRYPT_CHECKSALT(3)

πŸ“¦
version 4.5.2+20251210 Β· 2 versions
  • 4.5.2+20251210 Β· arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 4.4.18 Β· centos-stream 9
, in arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ“– CRYPT_CHECKSALT(3) πŸ’–

✨ NAME ✨

okay so this is the manual page for crypt_checksalt, and it's giving validate a crypt setting string 🫢

πŸŽ€ LIBRARY πŸŽ€

This lives in the Crypt Library (libcrypt, -lcrypt) 🧚

πŸ’… SYNOPSIS πŸ’…

#include <crypt.h>

int
crypt_checksalt(const char *setting);

πŸ¦‹ DESCRIPTION πŸ¦‹

bestie, crypt_checksalt checks your setting string against the system configuration and tells you whether the hashing method and parameters it asks for are acceptable πŸ‘‘ It's built for stuff like login(1), which needs to figure out if the user's passphrase should get re-hashed with the currently preferred method. literally so useful 😭

🌸 RETURN VALUES 🌸

The return value is 0 if nothing is wrong with this setting ✨ Otherwise you get one of these constants:

  • CRYPT_SALT_OK β€” the setting string is fully correct πŸ’– This constant is guaranteed to equal 0.
  • CRYPT_SALT_INVALID β€” ngl, this one means the setting string is not valid πŸ’€ Either it asks for a hashing method this version of libxcrypt doesn't know, or it passes invalid parameters for the method.
  • CRYPT_SALT_METHOD_DISABLED (Not implemented, yet) β€” this setting uses a hashing method that's totally banned now 🚫 crypt will fail if you pass it this setting. Manual intervention will be required to reactivate the user's account 😬
  • CRYPT_SALT_METHOD_LEGACY β€” this method isn't considered strong enough for new passphrases anymore πŸ₯€ crypt will still authenticate a passphrase against this setting. But if authentication succeeds, the passphrase should be re-hashed using the currently preferred method πŸ”„
  • CRYPT_SALT_TOO_CHEAP (Not implemented, yet) β€” the cost parameters here are considered too cheap for new passphrases 🍬 crypt will still authenticate against this setting. If that works, the passphrase should be re-hashed using the currently preferred method.

🧚 FEATURE TEST MACROS 🧚

<crypt.h> will define the macro CRYPT_CHECKSALT_AVAILABLE if crypt_checksalt is available in the current version of libxcrypt ✨

πŸ™ˆ BUGS πŸ™ˆ

ngl this one's a little sad πŸ₯Ί Since full configurability isn't implemented yet, the current implementation will only ever return CRYPT_SALT_OK (0) or CRYPT_SALT_INVALID when invoked.

πŸ“ PORTABILITY NOTES πŸ“

crypt_checksalt is not part of any standard, so don't expect it everywhere 🫠 It was added to libxcrypt in version 4.3.0.

πŸ”₯ ATTRIBUTES πŸ”₯

For an explanation of the terms used in this section, check out attributes(7) πŸ€“

  • Interface: crypt_checksalt
  • Thread safety: MT-Safe 🧡✨

🌈 SEE ALSO 🌈

crypt(3), crypt_gensalt(3), crypt(5) πŸ’œ


libxcrypt, November 8, 2018, CRYPT_CHECKSALT(3) πŸ¦‹ that's a wrap, bestie!! πŸ’…βœ¨

πŸ“¦ where this page comes from