Why is the header text-based? #497
Replies: 1 comment
-
I've found this discussion on the mailing list which mostly answers my question https://groups.google.com/g/age-dev/c/Td-2MtU6p1I I agree that header compactness should be a non-goal, but my interests lie in making parsing easier and safer.
You can do this with binary formats too, if you make the "magic bytes" contain a human-readable string. (better yet, have those bytes added to the
I can agree on the second part, but I can't agree with the first - although that's clearly a matter of personal opinion. I agree that modern languages make dealing with strings nicer, but the flip-side is that older languages (e.g. C) make dealing with strings a pain. I believe that a binary format would be easier to implement across a diverse set of languages. |
Beta Was this translation helpful? Give feedback.
-
From my perspective, the decision to use a text-based header format is a slightly strange one.
As an implementer, extra care must be taken regarding whitespace handling, ensuring that base64 encodings are canonical, etc. In general, text-based parsing is more fiddly and has more edge-cases to consider than binary format parsing (IMHO).
As an end-user, there is little benefit to being able to read the headers visually, since they're still very opaque. Information about the number and types of recipients could easily be reported by a command-line tool option, if desired.
Is there some benefit or rationale that I haven't considered?
During my process of understanding age, I've uncovered a couple of issues in existing implementations, both of which I'd put under the category of "parsing text is hard":
scrypt recipient parser accepts non-canonical integer encodings jojonas/pyage#6
Quadratic time complexity when parsing long recipient stanzas str4d/rage#368
I can't help thinking that these issues could've been avoided if age used a binary format. Maybe something to consider for an "age v2"?
(note: I originally created an issue here, but I've now moved it to this discussion since this seems to be the best place for it)
Beta Was this translation helpful? Give feedback.
All reactions