Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



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 "Jan 10 2012" The Rockbox Crew
aaa