equant Posted January 17, 2020 Report Share Posted January 17, 2020 In a different thread (over in software), @Dog Cow mentioned that there are magic numbers which can be used to distinguish which version of the stuffit algorithm was used to compress a file. Does anyone have more information on this? I would like to build a utility that can sort *.sit files, or perhaps improve the unix 'file' command to report a bit more than just "StuffIt Archive" when it sees "SIT!". I believe I can compress the same file with different versions and reverse engineer it, but figured I'd ask in case someone had this info somewhere. Thanks, Nathan Quote Link to post Share on other sites
Crutch Posted January 17, 2020 Report Share Posted January 17, 2020 This is a great idea. Quote Link to post Share on other sites
uyjulian Posted January 17, 2020 Report Share Posted January 17, 2020 I would recommend that you check out unar source code, which can extract Stuffit files (including resfork): https://cdn.theunarchiver.com/downloads/TheUnarchiverSource.zip Quote Link to post Share on other sites
olePigeon Posted January 17, 2020 Report Share Posted January 17, 2020 Would it be possible to make an INIT for System 6 and 7 that overrides the System Bundle icons for Stuffit files with one containing a version number? I could make up a set of icons for it. Then you could tell right off the bat which version of Stuffit you'd need. Quote Link to post Share on other sites
Crutch Posted January 17, 2020 Report Share Posted January 17, 2020 That’s a fun idea for a project. It’s not immediately obvious to me how to do that, since the Finder (or more likely a DRVR running in the background, launched by the INIT) would need to actually open the StuffIt archive and read far enough into it to get the magic number (if it’s there) each time it needed to decide what icon to draw. Patch _GetResource, and if the Finder is the foreground app and it’s getting an ICN# resource corresponding to an archive document from StuffIt, look up the file whose icon is being drawn (but how do I know which one that is???) in the precomputed hashtable of known archives and return the appropriate icon you designed ... and if the file hasn’t been seen before, stop and open it up to check the type and populate the hashtable entry? ...... or something. If I didn’t have a newborn, I would try it. Unless someone is super expert at how the Finder draws file icons, it would probably require a long Macsbug session. Quote Link to post Share on other sites
PowerPup Posted January 18, 2020 Report Share Posted January 18, 2020 The GitHub mirror for The Unarchiver have some amazing, reverse-engineered, documentation on the Stuffit Formats: https://github.com/mietek/theunarchiver/wiki/StuffItFormat https://github.com/mietek/theunarchiver/wiki/StuffIt5Format Quote Link to post Share on other sites
equant Posted January 18, 2020 Author Report Share Posted January 18, 2020 @PowerPup Thanks for those links. Looks perfect. I went ahead and did some tests and here's what I came up with. Looks like it's easy to tell apart pre 1.5.1, 1.5.1, 3.5 and 5.5. Quote Link to post Share on other sites
Iesca Posted June 22, 2020 Report Share Posted June 22, 2020 @equant Did you end up having any luck with this? Quote Link to post Share on other sites
equant Posted July 8, 2020 Author Report Share Posted July 8, 2020 On 6/21/2020 at 5:44 PM, Iesca said: @equant Did you end up having any luck with this? A little luck, but not a lot. You can reliably tell the difference between "5.5 or later" or "pre 5.5". I found this to be a useful distinction when browsing archives. I implemented it into the RetroBridgeBBS interface so that I can tell (when browsing online archives) if the file I want to download is compatible with my machines running system 6 or early system 7 software or not. https://github.com/equant/RetroBridgeBBS This shows the basic idea of predownloading just the file's header, and then determining if it's old or new Stuffit. sit_patterns = [ [b"^SIT!", "StuffIt pre 5.5"], [b"^StuffIt", "StuffIt 5.5 or later"], ] headers = {"Range": "bytes=0-200", 'User-Agent': USER_AGENT} header = requests.get(self.url, headers=headers).content for p in self.sit_patterns: r = re.compile(p[0]) m = r.match(header) if m: print(f"File is archived with: {p[1]}") Getting a more precise version out of an archive is certainly possible, but it wasn't worth the work to me. Quote Link to post Share on other sites
LaPorta Posted July 8, 2020 Report Share Posted July 8, 2020 Another good idea is for everyone to make StuffIt 1.5.1 archives for everything under System 6, etc... Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.