Python crypt

From wikinotes
Revision as of 00:54, 21 March 2021 by Will (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

builtin to python, encrypts strings using the OS's crypt.c.
only available on unix-like systems.

import crypt

# use strongest available
crypt.crypt('password')

# use specific algorithm
crypt.crypt('password', crypt.mksalt(crypt.METHOD_SHA512))