tgriesser / checkit

simple, flexible validations for node and the browser
MIT License
223 stars 53 forks source link

bcrypt password hash validation #86

Open mjhm opened 7 years ago

mjhm commented 7 years ago

Any interest in a PR for a bcrypt password hash validation? It would be a simple regex matcher of /^\$2[aby]?\$[\d]+\$[./A-Za-z0-9]{53}$/ (Ref https://pythonhosted.org/passlib/lib/passlib.hash.bcrypt.html#format-algorithm)

A more general version of this would be password hashes in "modular crypt" format.
/\$[a-z0-9-]+\$[0-9A-Za-z./+=,$-]+$/ (Ref: https://pythonhosted.org/passlib/modular_crypt_format.html)

(Unfortunately lots of other password hash formats are all over the map with various combinations fixed length Base64 strings, prefixes, and field separators, so a general passwordHash validator would probably be watered down to accept almost anything.)