sentry.hashers.unix – sentry.hashers.unix module reference

Unix crypt and shadow-password compatible hasher

class sentry.hashers.unix.CryptHasher

Bases: sentry.hashers.BaseHasher

hsh(clear, salt)
>>> h = CryptHasher()
>>> h.hsh("test", "AB")
'ABwOg1D2JDxIQ'
class sentry.hashers.unix.ShadowHasher

Bases: sentry.hashers.BaseHasher A hasher that generates and can validate hashes in the same format as in /etc/shadow

hsh(clear, salt)
>>> h = ShadowHasher()
>>> h.hsh("test", "xJBzKU6.")
'$1$xJBzKU6.$1l5fqc8iRd6JnwCJajOVr.'
>>> h.hsh("testreallylongmoreethan16", "testsalt")
'$1$testsalt$BM2C2Ty9lJuKtUpj4m5nf1'