Skip to main content

Module password

Module password 

Source
Expand description

Excel-compatible password hashes for protection (ECMA-376 Part 1 §18.2.29 and §18.3.1.66 attribute sets): the legacy 16-bit hash (password="CC1A") and the iterated, salted hash (algorithmName, hashValue, saltValue, spinCount). Protection is a convenience, not security, but verification really checks the password: an unsupported variant is refused, never accepted.

Enums§

PasswordHash

Constants§

DEFAULT_SPIN_COUNT
Excel’s default spin count for new passwords.
MAX_SPIN_COUNT
Largest spin count accepted when verifying (the documented maximum); a file asking for more would only make verification hang.

Functions§

legacy_hash
The legacy 16-bit password hash: each UTF-16 unit contributes its low byte (its high byte when the low one is zero), folded in from the last character with a 15-bit rotation, then the length and the constant 0xCE4B.
salt_from
A 16-byte salt derived from seed (callers mix in what varies: names, a counter, the clock).