View Javadoc

1   //Copyright (C) 2004, Brian Enigma <enigma at netninja.com>
2   //This file is part of MagicCodes.
3   //
4   //MagicCodes is free software; you can redistribute it and/or modify
5   //it under the terms of the GNU General Public License as published by
6   //the Free Software Foundation; either version 2 of the License, or
7   //(at your option) any later version.
8   //
9   //MagicCodes is distributed in the hope that it will be useful,
10  //but WITHOUT ANY WARRANTY; without even the implied warranty of
11  //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  //GNU General Public License for more details.
13  //
14  //You should have received a copy of the GNU General Public License
15  //along with Foobar; if not, write to the Free Software
16  //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  package org.ninjasoft.magiccodes.plugins;
18  
19  /***
20   * The Texel code from the MU arg.  In this representation, the first byte is
21   * plaintext.  It gets XORed with the next byte, etc.
22   * 
23   * Sample data 1:
24   * 741116071d0709470844030e050d07094743110b09041b1c10111b19045446091d52531606160717455406130f1d1e041a001a060147
25   * 
26   * Sample data 2:
27   * 771e070a480c52130807420c42101b0e0f1c5453061b400e4809131644541b4f5316004b0e4302041612135e0c43020f495354440b4f4d18160b484e0118590e4e0b13131752531b071a1908444809171345430c02084b0e571e05004c54060b59541b4f55051c030e054441050010184c4405151541490f4643020f    
28   * @author enigma
29   */
30  public class TexelCode implements Plugin {
31  	public String getName() {
32  		return "Texel Decode";
33  	}
34  	public String getDescription() {
35  		return "The chaining XOR code Texel used in MU";
36  	}
37  	public boolean usesKey() {
38  		return false;
39  	}
40      public boolean isInformational() {
41          return false;
42      }
43  	public int[] doAction(int[] in, int[] key) {
44          int previous = 0;
45          for (int i=0; i<in.length; i++) {
46              int newValue = (in[i] ^ previous) % 256;
47              previous = newValue;
48              in[i] = newValue;
49          }
50          return in;
51  	}
52  }