R.Wieser wrote:
> :-) I've been looking at that too - if only to see whats actually in that
> "search.json.mozlz4" file. Presumably the same as in the "search.json"
> file, but you never know. The compression seems to be LZ4, and I did manage
> to find a Windows DLL for it (on GitHub). I also found some references to
> programs (in sourcefile format) to at least unpack it.
I wrote such a program myself. A short piece of C code to call "lz4.dll",
so not exactly rocket science :-) I never try to work too hard when
I write code - I am a copy/pasta programmer by nature.
You should open "search.json.mozlz4" and "search.json" in
a text editor and compare them. The LZ4 compressor is little
better than RLE. You can read a lot of the text strings
under mozlz4, or guess at their formulation. It's not
a compressor, and not even a good obfuscater. It's
a nuisance-ifier.
It does make you wonder what they were thinking when they
applied LZ4 :-)
Writing the compressor call, would be good exercise for you :-)
And why wouldn't LZ4.c be in the Firefox tarball ? You should
not necessarily have to go to another site to get it.
gcc -c lz4.c
gcc -c unmoz.c
gcc -o unmoz.exe lz4.o unmoz.o
See, it's hard hard work. You have to check the label on
the thing, to see whether they've changed it or not. This
is a small snippet from the program.
/* mozLz40\0 */
/* 109, 111, 122, 76, 122, 52, 48, 0 */
if ( bufin[0] != 109 ||
bufin[1] != 111 ||
bufin[2] != 122 ||
bufin[3] != 76 ||
bufin[4] != 122 ||
bufin[5] != 52 ||
bufin[6] != 48 ||
bufin[7] != 0 ) {
perror("\n Version magic does not match mozLz40\n");
return 0;
}
I wrote this because I wanted my damn output, not because
the source code is "pretty". If you want the compression
function, copy it from the tarball. There would have to
be a pre-format call before lz4() is called, to put the
version string on it. Since they write out mozlz4 files,
using Firefox, the compressor code has to be in there. And
with the correct header, a portion of which is demoed above.
You could try a text search on "mozLz40" and see what pops up
in the unpacked tarball.
361MB (unpack with 7ZIP or whatever)
http://releases.mozilla.org/pub/firefox/releases/90.0/source/firefox-90.0.source.tar.xz
Paul