File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,11 +158,26 @@ char *key;
158158 int i ;
159159 int len = strlen (key );
160160 for (i = 0 ;i < len ;i ++ ) {
161+ #ifdef BUGGY_CODE_BW_COMPAT
162+ /* This is the code as it was originally released.
163+ It causes warnings on many systems and can generate
164+ different results as well. If you have files
165+ encrypted using an older version you may want to
166+ #define BUGGY_CODE_BW_COMPAT so as to be able to
167+ decrypt them... */
161168 k1 = (((k1 <<3 | k1 <<-13 ) + key [i ]) & 65535 );
162169 k2 = (((k2 <<3 | k2 <<-13 ) ^ key [i ]) & 65535 );
163170 k3 = (((k3 <<3 | k3 <<-13 ) - key [i ]) & 65535 );
164171 k4 = ((key [i ] - (k4 <<3 | k4 <<-13 )) & 65535 );
165172 k5 = (((k5 <<3 | k5 <<-13 ) ^ ~key [i ]) & 65535 );
173+ #else
174+ /* This code should be more portable */
175+ k1 = (((k1 <<3 | k1 >>13 ) + key [i ]) & 65535 );
176+ k2 = (((k2 <<3 | k2 >>13 ) ^ key [i ]) & 65535 );
177+ k3 = (((k3 <<3 | k3 >>13 ) - key [i ]) & 65535 );
178+ k4 = ((key [i ] - (k4 <<3 | k4 >>13 )) & 65535 );
179+ k5 = (((k5 <<3 | k5 >>13 ) ^ ~key [i ]) & 65535 );
180+ #endif
166181 }
167182 r -> key [0 ] = (short )k1 ;
168183 r -> key [1 ] = (short )(k2 |1 );
You can’t perform that action at this time.
0 commit comments