22 ms·
This is very interesting, but just curious, when would you use something like this versus, say, protobufs?
by nullspace 6y ago
This is very interesting, but just curious, when would you use something like this versus, say, protobufs?
- vander_elst 6y agoIf I understand it correctly, katai generates for you the reader as well, while protobuf generates only the data container. Katai is more a sort of protobuf + grpc for reading data.
- lima 6y agoProtobufs generate readers/writers for various languages (i.e. serialization/deserializiation). gRPC is an RPC framework that uses Protobufs.
- jackjeff 6y agoBig difference is Katai is designed to parse existing binary formats like PNG, JPEG, MIDI, WAV files. Things like Protobuf can serialize/deserialize any data but it’s very opiniated about how to do this. You won’t convince it to work with existing file formats.
- uerg 6y agoIf you try to speak a protocol which is not yours.
- UncleEntity 6y agoKaitai Struct can read any 'ol random data format while protobufs (I assume) are only able to read/write a specific protocol. I was playing with it a while back along with wasm and got it to decode all the individual opcodes (along with the rest of the file) but it turned out to be really, really slow in the generated python version. C++ probably has much better performance but I haven't actually tested the difference.
- tubs 6y agoLast time I looked at it, it generated sub-objects as pointers allocated with new, which was a bit meh.
- karlding 6y agoProtocol Buffers and Kaitai structs solve different problems, although they both deal with serialized data. With a protobuf, you don't really care about how the data that you're serializing into the binary buffer is represented in the binary format. All you care about is that your data can be serialized and deserialized. Conversely, Kaitai allows you to control and specify the representation of the serialized data. This allows you to specify arbitrary formats (like image formats, for example). Essentially you start with the serialization format instead of starting with the deserialized data (or like how the title of this submission says, "describe the structure of data"). As such, you can somewhat describe protobufs [0] using Kaitai structs, but the converse is not necessarily true. There's actually a section under their FAQ [1] with a more in-depth response to this. [0] https://formats.kaitai.io/google_protobuf/index.html https://formats.kaitai.io/google_protobuf/index.html [1] https://doc.kaitai.io/faq.html#vs-protobuf https://doc.kaitai.io/faq.html#vs-protobuf
- imtringued 6y agoYou can use it to reverse engineer specifications for arbitrary binary data.