Welcome to the Creatures Wiki! Log in and join the community.

Difference between revisions of "Talk:MNG files"

From Creatures Wiki
Jump to navigation Jump to search
(Removing old discussion of the C code which is no longer relevant.)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Since we have a VB and assembler example,
+
I'm cleaning up the C code that was here, since the best version of it appears in the article now.
why not a C example? C is very popular, and all.
 
 
 
<pre>
 
#include <stdlib.h>
 
#include <stdint.h>
 
 
 
uint8_t *scramble(uint8_t *data, uint32_t length)
 
{
 
    uint8_t hb  = 0x5;
 
    uint8_t *out = (uint8_t *) malloc(sizeof(uint8_t) * length);
 
    uint8_t i;
 
 
 
 
 
    for (i = 0; i < length; i++) {
 
        out[i] = data[i] ^ hb;
 
        if (hb < 0x3F)
 
            hb += 0xC1;
 
        else
 
            hb += (0xC1 - 0x100);
 
    }
 
   
 
    return out;
 
}
 
</pre>
 
 
 
Does that code look alright? [[User:Dylan|Dylan]] 16:55, 7 Feb 2005 (PST)
 

Latest revision as of 19:21, 20 March 2005

I'm cleaning up the C code that was here, since the best version of it appears in the article now.