Monthly Archives: April 2007

Destral

I have started a new open source project called Destral. It is a command-line utility to split and join files, much like Hacha and HJSplit.

The main advantages of Destral over Hacha and HJSplit are:

  • Multiplatform
    It is written in pure C, therefore it should build in every operating system with a C compiler.
    This single utility works the same for Linux, Windows, Mac, etc, forget about using a different utility in each operating system. Same use, same flags, same everything.
  • Destral is able to split and join using Hacha 3.0, Hacha 3.5 and HJSplit formats. To state it clearly: Destral does not use a new split and join algorithm. It does not need Hacha 3.0, Hacha 3.5 or HJSplit to work, I have implemented the algorithms.
  • Destral is intelligent and uses sensible defaults.
    Most times you will not need to tell it what split and join algorithm you want to use, it will discover.
    For instance, when you want to join several chunks in a file you just run destral -j myfile.0, or destral -j myfile.000, or destral -j myfile.001 (at this moment you need to provide it with the path for the first chunk, but this weekend I will make it intelligent enough to search for the first chunk if you pass, for instance, chunk #3).

There is no release yet, if you are interested you will need to access the code via Subversion. The only dependency besides a C compiler is CMake, but it’s possible and easy to build it without CMake.

Current features:

  • Join Hacha 3.0, Hacha 3.5 and HJSplit/lxsplit files (no CRC check in Hacha files yet)
  • Multiplatform
  • It works and is very fast

Known bugs: there is an issue I just discovered with the names of the joint file under certain conditions, I will fix this soon.

Future features:

  • Fix bugs
  • Implement splitting of files, with sensible defaults: Destral will automagically select certain chunk sizes depending on the input file (it will be possible to override that using parameters).
  • GUI
  • CRC reverse engineering (the Hacha developer does not answer my e-mails, so I have no information about the CRC algorithm he is using)

"Reverse-engineering" Hacha

In Spanish-speaking forums and websites a lot of people use Hacha (a win32-only app) to split a large file into several smaller chunks. English-speaking people prefer HJSplit, which has a Linux version called lxsplit.

On one hand, I cannot understand why people keep using these programs as you could just use a compressor (WinZip, WinRAR) and set the compression ratio to zero: it would be as fast as Hacha and HJSplit and everybody already has WinZip and/or WinRAR. On the other hand, I cannot change people’s mind and using wine to run Hacha is a pain in the ass in my 64-bit KUbuntu (32-bit chroot, yadda, yadda).

I have tried to contact the author of Hacha to no avail. I suspected the algorithm was easy but I like to play nice: I kindly requested information about the algorithm Hacha is using to split files. After some weeks without an answer, tonight I gave KHexEdit a try and you know what? I was right: the split & join algorithm in Hacha 3.5 is extremely simple.

There is a variable-length header which consists of:

  • 5 bytes set to 0x3f
  • 4 bytes CRC. If no CRC was computed, CRC is 1 byte set to 0×07 followeb by 3 bytes set to 0×00. If CRC was computed, its 4 bytes are here. I have not discovered the CRC algorithm yet.
  • 5 bytes set to 0x3f
  • Variable number of bytes representing the filename of the large file (before splitting/after joining). This is plain ASCII, no Unicode involved.
  • 5 bytes set to 0x3f
  • Variable number of bytes representing an integer which is the size of the large file (before splitting/after joining). Let’s name it largeFileSize.
  • 5 bytes set to 0x3f
  • Variable number of bytes representing the size of each chunk except the first (the one which ends with ".0") and the last. Let’s call it chunkSize. The size of the first chunk is chunkSize + headerSize. The size of the last chunk is largeFileSize – (n-1)*chunkSize.
  • 5 bytes set to 0x3f

And that’s all you need to know if you want to implement the Hacha 3.5 algorithm. I will be doing that in the next few days and releasing this program under the GPL.

Update I had not realized there is CRC information. The information I had here corresponds to the trivial case (no CRC), but I’m yet to find out the CRC algorithm. Reversing CRC – Theory and Practice seems a good starting point.

Crazy hypothesis about Bin Laden

It’s been five and a half years now since the Twin Towers attack and Osaba Bin Laden is yet to be found. As time goes by, more and more is known about the ties between the Bush family and the Bin Laden family and how the Bin Ladens were let go without any questioning right after September 11th.

I, therefore, have come with a new hypothesis trying to explain why nobody has found Osama Bin Laden after more than five years of search.

Say the Bushs fucked the Bin Ladens in one or more than one of their common business. Say the little Osama did not take it too well. Say the little Osama is using the muslims to act on his behalf without the muslims knowing.

Essentially, it goes like this: the Bush family played some dirty tricks on the Bin Laden business and Osama wanted retaliation. How to get retaliation against a so powerful “enemy”? Use someone without him knowing. The muslims were the perfect target: there had already been some itch between the USA and the muslim world for many years before Sept. 11th, 2001. Osama Bin Laden disguises himself into a radical muslim cleric and calls for the Jihad against the USA with great success. Most probably the plan was to leave the radical muslim world after the WTC attack but it was so successful, so compelling for many muslim and anti-USA people, that he could not just disappear on Sept. 12th and he is forced to keep acting, to release some speeches on tape from time to time to feed the followers of this radical-Osama.

So, in summary, why haven’t we found Osama Bin Laden yet? I think it is because we are looking for the wrong Osamba Bin Laden. We are looking for a long-bearded Osama Bin Laden, one which is wearing a jallabah and a turban. But according to my hypothesis (which I can not proof), we should be looking for an occidental-looking Saudi Arab, one who dresses just like a rich French or British man would do: Armani suit, most probably without beard or moustache of any kind, doing business here and there and keeping himself far apart from muslims. He might even be pretending to be a Christian or Atheist. I make this proposition to the authorities: go and try to find that Osama Bin Laden, I am pretty confident you will find him.

One more thing: if my hypothesis is correct, Osama Bin Laden might have tried to use other useful fools before the muslims (Hugo Chavez/Fidel Castro, radical jews, the Chinese, etc.) but none of them dared to conduct such an attack on the USA.