Live data from Hacker News

Parsing an Undocumented File Format

blog.vivekpanyam.com

51–60 of 65 posts

Re: Parsing an Undocumented File Format

#51
post #10

Reverse engineering data formats is one of the most fun and satisfying things to do in programming.

Reverse-engineering a Postman backup file was fun as well. There are OpenAPI schemas, but I found many undocumented fields, and it was not at all obvious when default values for settings were set and when not. Probably a mix of glitches from schema evolution and fields that Postman uses internally.

Re: Parsing an Undocumented File Format

#52
post #48
post #34

Earlier quoted context omitted.

I'm reminded of the comment in XeePhotoshopLoader.m: // At this point, I'd like to take a moment to speak to you about the Adobe PSD format. // PSD is not a good format. PSD is not even a bad format. Calling it such would be an // insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having // worked on this code for several weeks now, my hate for PSD has grown to a raging fire // that burns…

> I can only imagine that they make this process so // difficult because they are intensely ashamed of having created this abomination. They also don't want anybody building a dependency on that sh*t, which would prevent them from ever cleaning up the mess.

That ship has sailed: https://www.hyrumslaw.com/ and, of course, the obligatory xkcd https://xkcd.com/1172/

When I read that rant comment, I thought of "oh, so it's microservices writing to a shared byte array" in a nod to https://en.wikipedia.org/wiki/Conway%27s_law

Re: Parsing an Undocumented File Format

#53
post #10

Reverse engineering data formats is one of the most fun and satisfying things to do in programming.

Followed, hopefully, by publishing that info so it's not lost to the dustbin of time

Where I throw stones at myself is that I have a "perfect is the enemy of good" problem in that I don't publish writeups that are incomplete, because I keep hoping that if I just spend more holidays banging on it then I'll figure out why the parser works most of the time

Re: Parsing an Undocumented File Format

#55
post #40
post #6

Earlier quoted context omitted.

That’s what I was gonna say. Reverse engineering was the only way in the 90’s as documentation was scarce. I had to reverse anything if I wanted to understand how it worked. Here is an extractor I wrote for Westwood PAK and Lucasarts LFD files when I was 16: https://gist.github.com/ssg/e3e9654612be916336c01e104b10ddc7

I picked apart some of the Dark Forces files myself as a kid. The GOB file was pretty obvious - I was familiar with Doom WADs, it's basically the same. I figured out the graphics formats by setting up VGA 320x200 mode with the contents of a .PAL file, and dumping the graphics file into screen memory. Then looking at the noise around the familiar patterns to figure out all the run/skip length stuff that wasn't just a…

Fantastic! I love how we’ve been through the same stuff despite being perhaps continents apart.

Re: Parsing an Undocumented File Format

#56
post #27

Brings back memories of a similar task I have with importing MS Access files (the MS Access file format is undocumented). I am trying to parse the MS Access files using NodeJS/Javascript. I last tried about 3 years ago and it was really tough going, so there is a lot of trial and error. I am able to parse some basic MS Access files, but need to figure out a way to get the whole database more reliably. My effort was h…

oh god, that sounds like a painful thing to try to do. there's an Access redistributable at https://www.microsoft.com/en-us/download/details.aspx?id=549... i've never attempted JS interop, so i don't know how much it sucks, but it definitely seems doable. it'll likely be an adventure on it's own, but it's gotta be 1000x less fuckery than trying to reverse the binary format of Access the saner option would probably ju…

Yes, it is extremely painful. Thanks for the link, that may come in useful. But in general, the reason that I didn't use the Access redistributable is because I am building a Low Code system that I want to be able to import the Access database files that can work on Linux, Windows, or Mac.

Re: Parsing an Undocumented File Format

#57
post #48
post #34

Earlier quoted context omitted.

I'm reminded of the comment in XeePhotoshopLoader.m: // At this point, I'd like to take a moment to speak to you about the Adobe PSD format. // PSD is not a good format. PSD is not even a bad format. Calling it such would be an // insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having // worked on this code for several weeks now, my hate for PSD has grown to a raging fire // that burns…

> I can only imagine that they make this process so // difficult because they are intensely ashamed of having created this abomination. They also don't want anybody building a dependency on that sh*t, which would prevent them from ever cleaning up the mess.

I think there's been a dependency since day 1. For example, I have lots of photos scanned in the 90's with my old (old old) scanner, and they are in .psd format. Which for instance, macos can still preview.

Re: Parsing an Undocumented File Format

#58
post #34

Earlier quoted context omitted.

I'm reminded of the comment in XeePhotoshopLoader.m: // At this point, I'd like to take a moment to speak to you about the Adobe PSD format. // PSD is not a good format. PSD is not even a bad format. Calling it such would be an // insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having // worked on this code for several weeks now, my hate for PSD has grown to a raging fire // that burns…

As a side note, I really miss Xee. It was clearly a labour of love and it showed - MacPaw has been a terrible steward ever since Dag handed it over to them. No updates other than straight up SDK bumps and recompiles, broken loading of random images in recent macOS/Apple Silicon, they somehow managed to break cropping in one of the two or three updates they did, still an Intel binary. Clearly they haven't tested it mo…

The Unarchiver still doesn’t handle multipart RAR files correctly fairly often, too.

Re: Parsing an Undocumented File Format

#59

It's very strange to have worked on an undocumented file format parser all night before checking HN before I sleep and seeing this. In my case, I am trying to unpack MIDI files that have been packaged in a proprietary format by a company called ToonTrack. They have two product lines: expensive VST instruments and MIDI files designed to be played on those instruments. It's an open secret that you don't need the expens…

Just in case anyone sees this and finds themselves curious, I actually just shipped the fix: https://ezkeys.kabaragoya.com/
Post reply on HN