summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-01-28 10:28:34 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-01-28 10:28:34 +0000
commitddd1551d3e129e7e27b3dc3bbfe800f4491ba318 (patch)
tree75af30daaaef033a637f402fad198545be5c5115
parentc47fadb11243cbf1e78515d024265b9b53645502 (diff)
downloadrockbox-ddd1551d3e129e7e27b3dc3bbfe800f4491ba318.tar.gz
rockbox-ddd1551d3e129e7e27b3dc3bbfe800f4491ba318.zip
The checksum is not a CRC
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5686 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--tools/scramble.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/scramble.c b/tools/scramble.c
index d94dabf96f..22d9513d4a 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -61,7 +61,7 @@ int main (int argc, char** argv)
61 unsigned long length,i,slen; 61 unsigned long length,i,slen;
62 unsigned char *inbuf,*outbuf; 62 unsigned char *inbuf,*outbuf;
63 unsigned short crc=0; 63 unsigned short crc=0;
64 unsigned long crc32=0; /* 32 bit checksum */ 64 unsigned long chksum=0; /* 32 bit checksum */
65 unsigned char header[24]; 65 unsigned char header[24];
66 unsigned char *iname = argv[1]; 66 unsigned char *iname = argv[1];
67 unsigned char *oname = argv[2]; 67 unsigned char *oname = argv[2];
@@ -143,7 +143,7 @@ int main (int argc, char** argv)
143 } 143 }
144 /* we store a 4-letter model name too, for humans */ 144 /* we store a 4-letter model name too, for humans */
145 strcpy(irivermodel, &argv[1][5]); 145 strcpy(irivermodel, &argv[1][5]);
146 crc32 = irivernum; /* start checksum calcs with this */ 146 chksum = irivernum; /* start checksum calcs with this */
147 } 147 }
148 148
149 else if(!strcmp(argv[1], "-iriver")) { 149 else if(!strcmp(argv[1], "-iriver")) {
@@ -202,7 +202,7 @@ int main (int argc, char** argv)
202 for (i = 0; i < length/2; i++) { 202 for (i = 0; i < length/2; i++) {
203 unsigned short *inbuf16 = (unsigned short *)inbuf; 203 unsigned short *inbuf16 = (unsigned short *)inbuf;
204 /* add 16 unsigned bits but keep a 32 bit sum */ 204 /* add 16 unsigned bits but keep a 32 bit sum */
205 crc32 += inbuf16[i]; 205 chksum += inbuf16[i];
206 } 206 }
207 break; 207 break;
208 case scramble: 208 case scramble:
@@ -237,7 +237,7 @@ int main (int argc, char** argv)
237 { 237 {
238 case add: 238 case add:
239 { 239 {
240 int2be(crc32, header); /* checksum, big-endian */ 240 int2be(chksum, header); /* checksum, big-endian */
241 memcpy(&header[4], irivermodel, 4); /* 4 bytes model name */ 241 memcpy(&header[4], irivermodel, 4); /* 4 bytes model name */
242 memcpy(outbuf, inbuf, length); /* the input buffer to output*/ 242 memcpy(outbuf, inbuf, length); /* the input buffer to output*/
243 headerlen = 8; 243 headerlen = 8;