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

RE: descramble

From: Björn Stenberg <bjorn_at_haxx.se>
Date: Tue, 11 Dec 2001 01:14:59 +0100 (CET)

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
Received on 2001-12-11

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy