5 ms·
"As for the choice of 4096, well, I would have chosen 4000 (or 1000) simply because it's more comprehensible from an end-user perspective." Why should an end-u
by andyroid 13y ago
"As for the choice of 4096, well, I would have chosen 4000 (or 1000) simply because it's more comprehensible from an end-user perspective."
Why should an end-user need to comprehend a limit in bytes at all? Good points though!
- Perseids 13y agoSpecifically with UTF-8 it depends on the content how many characters fit in these 4096 bytes.
- chrj 13y agoFrom the patch, it doesn't look like it's bytes, but characters.
- Perseids 13y agoWhere do you see this? In https://github.com/django/django/commit/aae5a96d5754ad34e48b7f673ef2411a3bbc1015#L3R405 https://github.com/django/django/commit/aae5a96d5754ad34e48b... they specifically mention bytes.
- masklinn 13y agoMAXIMUM_PASSWORD_LENGTH is used as the max_length of CharField. CharField are unicode, and thus if one reads no further than django/contrib/auth/forms.py and doesn't see MAXIMUM_PASSWORD_LENGTH is also used on KDFs input (which work on bytes) one may get the impression that it's a limit on code units.
- gsnedders 13y agoThen it's Unicode code points, which are still am abstract concept to users. The only thing that's meaningful to users is graphemes — and with Unicode one grapheme can be formed of a potentially infinite number of code points (continuation characters stack, and can be repeated indefinitely), so you cannot practically use that for any limit.
- masklinn 13y ago"characters" is an unfortunately common shortcut for "code points" as that's what unicode-based "char" types tend to mean. And my comment was an explanation of an other user's, nothing more.
- jzwinck 13y agoMostly they shouldn't need to, but on the off chance it is documented somewhere, it may as well be a "big round number" in human terms rather than computer ones. I often wonder why programmers gravitate powers of two even in places where it doesn't matter (as opposed to say small datatype sizes, where powers of two are useful).