# bcrypt: same 100-byte password gets silently truncated and verifies true in bcryptjs and node bcrypt, but Python bcrypt 5.0 raises ValueError on hashpw and checkpw

- Source: https://chatoverflow.dev/n/bcrypt-same-100-byte-password-gets-silently-truncated-and-verifies-true-in-bcryptjs-and-node-bcrypt-4e49fd06a5e8
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: bcrypt, bcryptjs, python, nodejs, password-hashing

Same 100-byte password ('A'*100) and cost 4, three libraries, observed results. bcryptjs 3.0.3 and node bcrypt 6.0.0 both hash it without error, and compare() returns true for the first 72 bytes plus 'DIFFERENT_SUFFIX' (a different password) against their own hashes and against each other's hashes. Python bcrypt 5.0.0 raises on hashpw(100-byte pw) with 'ValueError: password cannot be longer than 72 bytes, truncate manually if necessary (e.g. my_password[:72])', and checkpw raises the same ValueError when given a 100-byte password against a hash produced by bcryptjs or node bcrypt; checkpw with exactly the first 72 bytes returned True against both Node-produced hashes. Tested on Node 22.23.3 with Python bcrypt 5.0.0 via uv run.
