Rev 271 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
267 | daniel-mar | 1 | # Obfuscated filters |
2 | |||
272 | daniel-mar | 3 | ## Resource location |
267 | daniel-mar | 4 | |
5 | Obfuscated standalone filters: |
||
6 | - Windows resource: RCDATA\16001\0 |
||
7 | - MacOS resource: 'DATA' 16001 |
||
8 | |||
9 | Normal standalone filters: |
||
10 | - Windows resource: PARM\16000\0 |
||
11 | - MacOS resource: 'PARM' 16000 |
||
12 | |||
271 | daniel-mar | 13 | ## Implementation |
270 | daniel-mar | 14 | |
271 | daniel-mar | 15 | Defined in **ff.h**, implemented in **make.c**: |
267 | daniel-mar | 16 | |
271 | daniel-mar | 17 | void obfusc(PARM_T* pparm); |
18 | void deobfusc(PARM_T* pparm); |
||
19 | |||
20 | ### Obfuscation "Version 3" |
||
21 | |||
267 | daniel-mar | 22 | Introduced in **Filter Foundry 1.7.0.5** [30-Jul-2021] |
23 | |||
24 | It is compiler-dependant, therefore the resource cannot be exchanged between plugins! |
||
25 | |||
270 | daniel-mar | 26 | Algorithm: XOR with a modified `rand()`-stream with seed that is stored at position 0x30 |
267 | daniel-mar | 27 | (this field is not used in the `PARM` resource). |
28 | |||
270 | daniel-mar | 29 | 32 bit plugin is built with OpenWatcom (for Win95 compatibility) which has following formula: |
30 | |||
31 | int rand_openwatcom(unsigned int* seed) { |
||
32 | *seed = *seed * 1103515245L + 12345L; |
||
33 | return (*seed >> 16) & 0x7fff; /* Scale between 0 and RAND_MAX */ |
||
34 | } |
||
35 | |||
271 | daniel-mar | 36 | 64 bit plugin is built with Visual C++ which has following formula: |
270 | daniel-mar | 37 | |
38 | int rand_msvcc(unsigned int* seed) { |
||
272 | daniel-mar | 39 | *seed = *seed * 214013L + 2531011L; |
40 | return (*seed >> 16) & 0x7fff; /* Scale between 0 and RAND_MAX */ |
||
270 | daniel-mar | 41 | } |
42 | |||
271 | daniel-mar | 43 | ### Obfuscation "Version 2" |
267 | daniel-mar | 44 | |
45 | Introduced in **Filter Foundry 1.7b1** [20-Sep-2019] |
||
46 | |||
47 | It is compiler-independant! |
||
48 | |||
49 | Algorithm: [XOR-Shift](https://de.wikipedia.org/wiki/Xorshift "XOR-Shift") with hardcoded seed `0x95d4a68f`. |
||
50 | |||
51 | x32 = 0x95d4a68f; |
||
52 | for(i = size, p = pparm; i--;) { |
||
272 | daniel-mar | 53 | x32 ^= x32 << 13; |
54 | x32 ^= x32 >> 17; |
||
55 | x32 ^= x32 << 5; |
||
56 | *p++ ^= x32; |
||
267 | daniel-mar | 57 | } |
58 | |||
271 | daniel-mar | 59 | ### Obfuscation "Version 1" |
267 | daniel-mar | 60 | |
61 | Introduced in **Filter Foundry 1.4b8,9,10** |
||
62 | |||
63 | It is compiler-dependant, therefore the resource cannot be exchanged between plugins! |
||
64 | |||
65 | Algorithm: XOR with `rand()`-stream with hardcoded seed `0xdc43df3c`. |
||
66 | |||
67 | srand(0xdc43df3c); |
||
68 | for(i = size, p = pparm; i--;) { |
||
272 | daniel-mar | 69 | *p++ ^= rand(); |
271 | daniel-mar | 70 | } |
71 | |||
72 | The plugin is built with Visual C++ which has following formula: |
||
73 | |||
74 | int rand_msvcc(unsigned int* seed) { |
||
272 | daniel-mar | 75 | *seed = *seed * 214013L + 2531011L; |
76 | return (*seed >> 16) & 0x7fff; /* Scale between 0 and RAND_MAX */ |
||
271 | daniel-mar | 77 | } |
78 |