Hacker News new | ask | show | jobs
by marlin 1111 days ago
I am also working on a project in this space. It is a template format for binary data, and accompanying commandline tooling. It is usable today for tasks such as:

- generating structured binary diffs

- creating universal extractors, several custom game formats are covered already

It is in a early stage but would love some feedback!

https://github.com/martinlindhe/feng

2 comments

Is there allowance for file formats whose contents are dynamic, based on the values present in other parts of the file?

For instance "if value at offset X is 123, then treat this other block of data as format ABC, otherwise treat it as as DEF". Obviously can get complex. The Adobe PSD format does horrible things like this all over the place (:

Yes, see the "if statements" section in the (very terse) documentation https://github.com/martinlindhe/feng/blob/main/TEMPLATE.md#i...

You can see it in use in the PNG format template, here: https://github.com/martinlindhe/feng/blob/main/templates/ima...

Not wanting to derail your work but you could take a look at the pattern language here for inspiration. Seems as if it has the same goal https://docs.werwolv.net/pattern-language/
That's a cool project. I use ImHex myself but wasn't even aware of this.

Over the years there has been a silly amount of projects in this space, it is very hard to keep track of them all.

I did try to summarize the ones I know about in the feng project, see here, under "SIMILAR WORK":

https://github.com/martinlindhe/feng/blob/main/RESOURCES.md

Was there anything in particular you wanted to bring to my attention about the ImHex pattern language?

From a quick glance it looks similar indeed, with the same basic building blocks as feng (data types and structs), while they use a rust inspired format, and I use yaml format (however I also use the rust-inspired data type naming u8, u16, s16 and so on).

A major difference is that feng strives to be usable with minimal/no programming (a custom dsl was developed around this idea), while the ImHex pattern language does look rather classic programming focused data processing (like 010 templates but more pretty syntax)