Rockbox.org home
releases
current build
extras FAQ
manual
wiki
docs index mailing lists
IRC
forums bugs
patches



Rockbox mail archive

Subject: RE: descramble
From: Björn Stenberg (bjorn_at_haxx.se)
Date: 2001-12-11


Andy Choi wrote:

> (sum of all unscrambed bytes,

Ahhh, I should have guessed it was something that simple... :-)

> plus a version-specific offset)

Actually, the version offset is not needed. It was just a little mistake:

> // compute checksum
> int cksum = 0;
          ^^^
You're using a 32-bit integer for the 16-bit checksum, that's why it doesn't
match.

Here's my simple checksum program in C, using a 16-bit integer:

#include <stdio.h>

int main (int argc, char** argv)
{
   unsigned short crc=0;
   int a;
   while ((a = getc(stdin)) >= 0)
      crc += a;
   printf("crc: %04x\n",crc);
   return 0;
}

I'll make a full "scramble.c" and put it on the web page.

Good job!

/Björn



Page was last modified "Mar 9 2008" The Rockbox Crew