Results 1 to 3 of 3
  1. #1
    whatcouldisay is offline Member
    Join Date
    Nov 2010
    Posts
    1
    Rep Power
    0

    Default NEW to JAVA Crytography

    I WOULD LIKE TO DECRYPT the INFORMATION BELOW USING THIS JAVA CODE. PLEASE COULD someone SHOW ME THE STEP I NEED TO TAKE. IAM NEW TO PROGRAMMING.

    PHP Code:
    public class Encoder1
    
    {
    
       public static void main(String[] args)
    
       {
    
          if (args.length != 3)
    
          {
    
             System.out.println("USAGE: java Encoder1 plaintextfile encryptedfile key\n");
    
           System.out.println(" Where plaintextfile is the file you wish to encrypt");
    
           System.out.println(" and the encrypted version is placed in encryptedfile.");
    
             System.out.println(" key takes a value in the range (0-255).");
    
             return;
    
          }
    
    
    
          try
    
          {
    
            File file = new File(args[0]);
    
            if (!file.exists() || !file.isFile())
    
                {
    
                  System.out.println("File doesn\'t exist");
    
                  return;
    
                }
    
    
    
             FileInputStream plainin = new FileInputStream(file);
    
             FileOutputStream encryptedout = new FileOutputStream(args[1]);
    
    
    
           byte key = (byte)(Byte.parseByte(args[2]));
    
           // Should check key is in the right range
    
           int c;
    
    
    
           while((c = plainin.read()) >= 0)
    
             {
    
              // The following line is the encryption algorithm
    
                byte ec = (byte) (c^key);
    
                encryptedout.write(ec);
    
             }
    
    
    
             plainin.close();
    
             encryptedout.close();
    
          }
    
          catch (Exception exception)
    
          {
    
             exception.printStackTrace();
    
          }
    
       }
    
    }
    Java Code:
    /P3l+/z1suX69+b69+Cy5vr367L68+T3svb34fH3/Pb39rL04P3/sv3897L94LLh9+T34PP+n5ji
    8+D3/Oa/4eL38fv34byyxvr74bLi/fv85r6y+/Sy++ay8f3n/vay8Pey8f738+D39rLn4r6y5f3n
    /vay8PefmPv85vfg9+Hm+/z1qbL79L6y9P3gsvv84ebz/PH3vrL75rLx/ef+9rLw97Lh+v3l/LLm
    +vPmsub697L14Pfr+v3n/Pa+n5jw/v399vr95/z2vrLm9+Dg+/fgvrLh4vP8+/f+vrLz/Pay8Of+
    /r/2/fW+suX6+/H6suX3svP+/rL5/P3lsuLg/eLz9fPm95+Y5vr3++Cy+fv89rLh/bLm4Of+676y
    5ffg97Lm+vey/fT04eLg+/z1sv30svP867Lh+/z1/vey4eL38fv34b6y5vr3/LLh5/H6n5j08/Hm
    4bLl/ef+9rL68+T3svXg9/PmsuX3+/X65rL7/LL/8/n7/PWy5+Gy9v3n8Oay8/D95+ay5vr3svv/
    /+fm8/D7/vvm65+Y/fSy5vr3sv/z/Ouy5Pfg67Lx/v3h9/7rsvP+/vv39rLz/Pay/PPm5+Dz/rLh
    4vfx+/fhv7/0/eCy+/zh5vP88fe+sv30n5jm+vey//P867L0/er34b+/+/z68/D75vv89bL2+/T0
    9+D3/Oay4+fz4Ob34OGy/fSy5vr3suX94P72vLLbsvb9svz95p+Y8Pf++/fk976y8+Gy5fey4frz
    /v6y4uD34ff85v7rsuH3976y5vrz5rLz/v6y/efgsvb99eGy+vPk97L29+Hx9/z29/afmPTg/f+y
    8/zrsv3897Ll+/72suHi9/H79+GpsvDn5r6y+/yy5vr3svHz4fey/fSy4f3/97L95vr34LL2/f/3
    4eb78Z+Y4PPx9+G+sub69+D3svvhsuLg9+Hn/+Lm++T3vrL94LL35Pf8suHm4P389b6y9+T79vf8
    8fey+/yy9PPk/efgsv30sub6++GfmOT79+W8n5ifmNvmsvrz4bL99Ob3/LLw9/f8svPh4ef/9/ay
    5vrz5rL/8/yy+vPhsvH6/eH3/LL0/eCy9v3/9+Hm+/Hz5vv9/LLz/Pv/8/7hn5jz/Pay4v7z/Obh
    svrz5Pv89bLz/LL36ubg8/3g9vv88+Drsvv8+vfg9/zmsub3/Pb3/PHrsub9suTz4Ou+svP89p+Y
    /vv59+X74fey5v2y5fvm+uHm8/z2svb75Pfg4fey8f77//Pm9+G8stuy9v2y/P3msvb74eLn5vey
    5vrz5rLm+vfh95+Y8fPi8/H75vv34bL68+Z3nmS33p==

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,526
    Blog Entries
    7
    Rep Power
    20

    Default

    You file has every byte exclusive or-ed by a single value k. Try all different values for k (there are 256 ot them and 0 is a very unlikely key) and see what you get.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •