Closed waldyrious closed 9 years ago
Note that the current version, based on Nic's uses base64 encoding rather than base 16 (hex). So maybe the code can't be that simplified, but we shall see.
Note: the original code (b3c6bb2) is based on Nic's "1a" version (which ensures there's a lowercase letter and a number in the password). The non-1a version, besides the obvious difference, also uses a SHA1-based HMAC rather than SHA1 directly (see diff) but HMAC doesn't make sense since it's for message authentication, and in this case the message (website url + password) isn't being passed on the clear. The website domain is known, sure, but any tampering would change the hash (hence not produce the correct password), so using raw SHA1 suffices for our purposes.
"Fixed" in #16
Understand the algorithm and implement the code in a cleaner and more readable way.
small codebases to build from:
fcc
andcca
are shortcuts for the String object'sfromCharCode
andcharCodeAt
)code to understand the algorithm: