My encryption technique [COMPLETED]

The fear of every surveillance society: citizens protecting their own privacy with strong cryptography

My encryption technique [COMPLETED]

Post by moldyToast1 on Sun Jan 06, 2013 1:17 am
([msg=72062]see My encryption technique [COMPLETED][/msg])

So I was fooling around and I made my own encryption technique.
Every plaintext has 1 hash value, and there are 0 collisions possible (length can change.)

Screenshot of the program:
http://gyazo.com/84eefa5f7191c00cc550ceff6ab0123b.png?1357452766

Some example hashes:

password:IkwTvvpa-
tastyCipher v1.0:J@VvR&o5!B@4C86e
abcdefghijklmnopqrstuvwxyz:r4yMTR7^vkt!z%%0CxnMwnm`pxIa
1234567890:J!oi4wm5US%UIK
`~!@#$%^&*()_+-={}[]\|;':"./<>:PVuXS@UP@MH@oK7Nr8NJ5wt5oO7ol!xm$xS0vRZsRVG%QSb
yourSecretPassword_15952:q5Vi5VvqByz8XXW!C~pw8479i
0948149872:q4wi!oS@WkuZkJ
1578921895:mZkiBUIGykiWTK
yourUsername:yourPassword:IkwTvvpkkswkKAS6TkzXyzz4-

Download the .exe here: tastyCipher VirusTotal
Download the .jar here: tastyCipher fixed VirusTotal

If you have any problems with the program let me know,
Thanks for looking/downloading!

Will
Last edited by moldyToast1 on Sun Jan 06, 2013 12:23 pm, edited 1 time in total.
moldyToast1
New User
New User
 
Posts: 10
Joined: Sun Jan 06, 2013 1:06 am
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by fashizzlepop on Sun Jan 06, 2013 1:45 am
([msg=72063]see Re: My encryption technique [COMPLETED][/msg])

Can we get the source for this? I'd like to run it through my python bruteforcer.
The glass is neither half-full nor half-empty; it's merely twice as big as it needs to be.
User avatar
fashizzlepop
Developer
Developer
 
Posts: 2303
Joined: Sat May 24, 2008 1:20 pm
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by WallShadow on Sun Jan 06, 2013 11:55 am
([msg=72081]see Re: My encryption technique [COMPLETED][/msg])

Wowowowwow, hold on, what is the purpose of this encryption? is it supposed to be an encryption algorithm? a hash? a MAC?

Also, by the definition of encryption, this isn't an encryption algorithm, an encryption algorithm uses some sort of a key for it to be secure and unpredictable. Also, this can't be a hash because you have a decryption algorithm. A hash is designed not to have a decryption algorithm. The point of encryption is that they can't simply use the decryption algorithm to decrypt it.

But in all seriousness, good job my friend, you made a good effort at an encryption scheme. When i designed my first encryption algorithm, it was similar to this, but it used a key of 1 byte. Anyone who has studied ciphers should know that 8 bits is nowhere near secure. Funny this is, no one bothered to mention it when I posted that algorithm here :D

Try using a key of some 16 letters and just xor it with the output, make it a real encryption algorithm.
User avatar
WallShadow
Contributor
Contributor
 
Posts: 594
Joined: Tue Mar 06, 2012 9:37 pm
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by moldyToast1 on Sun Jan 06, 2013 12:00 pm
([msg=72083]see Re: My encryption technique [COMPLETED][/msg])

the point of this "Cipher" is so that it can easily be decrypted by someone who has the program, and yes I was mistaken in my vocabulary so thank you for that.

Will
moldyToast1
New User
New User
 
Posts: 10
Joined: Sun Jan 06, 2013 1:06 am
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by WallShadow on Sun Jan 06, 2013 12:05 pm
([msg=72084]see Re: My encryption technique [COMPLETED][/msg])

first off, the program doesn't run on my win vista with java 7 or my win XP with java 7 because of this error:

Code: Select all
java.io.FileNotFoundException: charset.dat (The system cannot find the file specified)
   at java.io.FileInputStream.open(Native Method)
   at java.io.FileInputStream.<init>(Unknown Source)
   at java.util.Scanner.<init>(Unknown Source)
   at gui.<init>(Unknown Source)
   at a.run(Unknown Source)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$200(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.awt.EventQueue$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


Looking into the jar file, it seems to have the mentioned file in it, which means you screwed something up with the java methods you use. You should know that java is very limited in terms of using file permissions and what not, try out several different methods to access the file and see what works, if you still have trouble, tell me, I can dig out an old project which did the same thing but succeeded in it.

edit: looks like the exe doesn't work either.
User avatar
WallShadow
Contributor
Contributor
 
Posts: 594
Joined: Tue Mar 06, 2012 9:37 pm
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by moldyToast1 on Sun Jan 06, 2013 12:24 pm
([msg=72085]see Re: My encryption technique [COMPLETED][/msg])

Fixed the jar file, sorry about that. Link is updated in main post or download the fixed jar here: http://www.mediafire.com/download.php?03fjmp0fdc6wpq1
moldyToast1
New User
New User
 
Posts: 10
Joined: Sun Jan 06, 2013 1:06 am
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by WallShadow on Sun Jan 06, 2013 12:27 pm
([msg=72086]see Re: My encryption technique [COMPLETED][/msg])

Fash, here's the java code if you can interpret it:

Encryption:

(code inside gui which initializes the gui)
Code: Select all
(localObject1 = new JButton("Encrypt")).addActionListener(new d(this, localJTextArea, (JTextArea)localObject2));


(the class d that is instantiated in the previous piece)
Code: Select all
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JTextArea;

final class d
  implements ActionListener
{
  d(gui paramgui, JTextArea paramJTextArea1, JTextArea paramJTextArea2)
  {
  }

  public final void actionPerformed(ActionEvent paramActionEvent)
  {
    paramActionEvent = this.a.getText().split("\n");
    this.b.replaceRange(null, 0, this.b.getText().length());
    for (int i = 0; i < paramActionEvent.length; i++)
      this.b.append(gui.a(paramActionEvent[i]) + "\n");
  }
}


(gui.a(String) method and gui.d(String) method which is used inside of gui.a())
Code: Select all
  public static String a(String paramString)
  {
    String str1 = b;
    String[] arrayOfString = c;
    paramString = paramString;
    str1 = str1;
    arrayOfString = arrayOfString;
    paramString = paramString;
    paramString = paramString.toUpperCase();
    String str2 = "";
    for (int i = 0; i < paramString.length() - 1; i++)
      str2 = str2 + arrayOfString[str1.indexOf(paramString.charAt(i))] + " ";
    paramString = str2 += arrayOfString[str1.indexOf(paramString.charAt(i))];
    str2 = "";
    for (i = paramString.length() - 1; i >= 0; i--)
      str2 = str2 + paramString.charAt(i);
    return d(paramString = str2);
  }



  private static String d(String paramString)
  {
    String str1 = null;
    String str2 = "";
    String str3 = "";
    for (int i = 0; i < paramString.length(); i += 2)
      if (i + 1 < paramString.length())
      {
        if ((str1 = paramString.charAt(i) + paramString.charAt(i + 1)).equals("--"))
        {
          str2 = str2 + "a";
        }
        else if (str1.equals("-."))
        {
          str2 = str2 + "b";
        }
        else if (str1.equals("- "))
        {
          str2 = str2 + "c";
        }
        else if (str1.equals(".-"))
        {
          str2 = str2 + "d";
        }
        else if (str1.equals(".."))
        {
          str2 = str2 + "e";
        }
        else if (str1.equals(". "))
        {
          str2 = str2 + "f";
        }
        else if (str1.equals(" -"))
        {
          str2 = str2 + "g";
        }
        else
        {
          if (!str1.equals(" ."))
            continue;
          str2 = str2 + "h";
        }
      }
      else
        str2 = str2 + paramString.charAt(paramString.length() - 1);
    for (i = 0; i < str2.length(); i += 2)
      if (i + 1 < str2.length())
      {
        if ((str1 = str2.charAt(i) + str2.charAt(i + 1)).equals("aa"))
          str3 = str3 + "i";
        else if (str1.equals("ab"))
          str3 = str3 + "j";
        else if (str1.equals("ac"))
          str3 = str3 + "k";
        else if (str1.equals("ad"))
          str3 = str3 + "l";
        else if (str1.equals("ae"))
          str3 = str3 + "m";
        else if (str1.equals("af"))
          str3 = str3 + "n";
        else if (str1.equals("ag"))
          str3 = str3 + "o";
        else if (str1.equals("ah"))
          str3 = str3 + "p";
        else if (str1.equals("ba"))
          str3 = str3 + "q";
        else if (str1.equals("bb"))
          str3 = str3 + "r";
        else if (str1.equals("bc"))
          str3 = str3 + "s";
        else if (str1.equals("bd"))
          str3 = str3 + "t";
        else if (str1.equals("be"))
          str3 = str3 + "u";
        else if (str1.equals("bf"))
          str3 = str3 + "v";
        else if (str1.equals("bg"))
          str3 = str3 + "w";
        else if (str1.equals("bh"))
          str3 = str3 + "x";
        else if (str1.equals("ca"))
          str3 = str3 + "y";
        else if (str1.equals("cb"))
          str3 = str3 + "z";
        else if (str1.equals("cc"))
          str3 = str3 + "A";
        else if (str1.equals("cd"))
          str3 = str3 + "B";
        else if (str1.equals("ce"))
          str3 = str3 + "C";
        else if (str1.equals("cf"))
          str3 = str3 + "D";
        else if (str1.equals("cg"))
          str3 = str3 + "E";
        else if (str1.equals("ch"))
          str3 = str3 + "F";
        else if (str1.equals("da"))
          str3 = str3 + "G";
        else if (str1.equals("db"))
          str3 = str3 + "H";
        else if (str1.equals("dc"))
          str3 = str3 + "I";
        else if (str1.equals("dd"))
          str3 = str3 + "J";
        else if (str1.equals("de"))
          str3 = str3 + "K";
        else if (str1.equals("df"))
          str3 = str3 + "L";
        else if (str1.equals("dg"))
          str3 = str3 + "M";
        else if (str1.equals("dh"))
          str3 = str3 + "N";
        else if (str1.equals("ea"))
          str3 = str3 + "O";
        else if (str1.equals("eb"))
          str3 = str3 + "P";
        else if (str1.equals("ec"))
          str3 = str3 + "Q";
        else if (str1.equals("ed"))
          str3 = str3 + "R";
        else if (str1.equals("ee"))
          str3 = str3 + "S";
        else if (str1.equals("ef"))
          str3 = str3 + "T";
        else if (str1.equals("eg"))
          str3 = str3 + "U";
        else if (str1.equals("eh"))
          str3 = str3 + "V";
        else if (str1.equals("fa"))
          str3 = str3 + "W";
        else if (str1.equals("fb"))
          str3 = str3 + "X";
        else if (str1.equals("fc"))
          str3 = str3 + "Y";
        else if (str1.equals("fd"))
          str3 = str3 + "Z";
        else if (str1.equals("fe"))
          str3 = str3 + "0";
        else if (str1.equals("ff"))
          str3 = str3 + "1";
        else if (str1.equals("fg"))
          str3 = str3 + "2";
        else if (str1.equals("fh"))
          str3 = str3 + "3";
        else if (str1.equals("ga"))
          str3 = str3 + "4";
        else if (str1.equals("gb"))
          str3 = str3 + "5";
        else if (str1.equals("gc"))
          str3 = str3 + "6";
        else if (str1.equals("gd"))
          str3 = str3 + "7";
        else if (str1.equals("ge"))
          str3 = str3 + "8";
        else if (str1.equals("gf"))
          str3 = str3 + "9";
        else if (str1.equals("gg"))
          str3 = str3 + "~";
        else if (str1.equals("gh"))
          str3 = str3 + "`";
        else if (str1.equals("ha"))
          str3 = str3 + "!";
        else if (str1.equals("hb"))
          str3 = str3 + "@";
        else if (str1.equals("hc"))
          str3 = str3 + "#";
        else if (str1.equals("hd"))
          str3 = str3 + "$";
        else if (str1.equals("he"))
          str3 = str3 + "%";
        else if (str1.equals("hf"))
          str3 = str3 + "^";
        else if (str1.equals("hg"))
          str3 = str3 + "&";
        else if (str1.equals("hh"))
          str3 = str3 + "*";
        else
          str3 = str3 + str1;
      }
      else
        str3 = str3 + str2.charAt(str2.length() - 1);
    return str3;
  }



Decryption:

(code inside gui which initializes the gui)
Code: Select all
(localObject1 = new JButton("Decrypt")).addActionListener(new e(this, (JTextArea)localObject2, localJTextArea));


(the class e that is instantiated in the previous piece)
Code: Select all
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JTextArea;

final class e
  implements ActionListener
{
  e(gui paramgui, JTextArea paramJTextArea1, JTextArea paramJTextArea2)
  {
  }

  public final void actionPerformed(ActionEvent paramActionEvent)
  {
    paramActionEvent = this.a.getText().split("\n");
    this.b.replaceRange(null, 0, this.b.getText().length());
    for (int i = 0; i < paramActionEvent.length; i++)
      this.b.append(gui.b(gui.c(paramActionEvent[i])) + "\n");
  }
}


(gui.b(String) method and gui.c(String) method)
Code: Select all
  public static String b(String paramString)
  {
    int j = 0;
    String str = "";
    for (int i = paramString.length() - 1; i >= 0; i--)
      str = str + paramString.charAt(i);
    paramString = str;
    str = "";
    paramString = paramString.split(" ");
    for (i = 0; i < paramString.length; i++)
      for (j = 0; ; j++)
      {
        System.out.println(j + ": " + paramString[i]);
        if (!c[j].equals(paramString[i]))
          continue;
        str = str + b.charAt(j);
        break;
      }
    return str = str.toLowerCase();
  }





  public static String c(String paramString)
  {
    String str = "";
    for (int i = 0; i < paramString.length(); i++)
      if (paramString.charAt(i).equals("a"))
      {
        str = str + "--";
      }
      else if (paramString.charAt(i).equals("b"))
      {
        str = str + "-.";
      }
      else if (paramString.charAt(i).equals("c"))
      {
        str = str + "- ";
      }
      else if (paramString.charAt(i).equals("d"))
      {
        str = str + ".-";
      }
      else if (paramString.charAt(i).equals("e"))
      {
        str = str + "..";
      }
      else if (paramString.charAt(i).equals("f"))
      {
        str = str + ". ";
      }
      else if (paramString.charAt(i).equals("g"))
      {
        str = str + " -";
      }
      else if (paramString.charAt(i).equals("h"))
      {
        str = str + " .";
      }
      else if (paramString.charAt(i).equals("i"))
      {
        str = str + "----";
      }
      else if (paramString.charAt(i).equals("j"))
      {
        str = str + "---.";
      }
      else if (paramString.charAt(i).equals("k"))
      {
        str = str + "--- ";
      }
      else if (paramString.charAt(i).equals("l"))
      {
        str = str + "--.-";
      }
      else if (paramString.charAt(i).equals("m"))
      {
        str = str + "--..";
      }
      else if (paramString.charAt(i).equals("n"))
      {
        str = str + "--. ";
      }
      else if (paramString.charAt(i).equals("o"))
      {
        str = str + "-- -";
      }
      else if (paramString.charAt(i).equals("p"))
      {
        str = str + "-- .";
      }
      else if (paramString.charAt(i).equals("q"))
      {
        str = str + "-.--";
      }
      else if (paramString.charAt(i).equals("r"))
      {
        str = str + "-.-.";
      }
      else if (paramString.charAt(i).equals("s"))
      {
        str = str + "-.- ";
      }
      else if (paramString.charAt(i).equals("t"))
      {
        str = str + "-..-";
      }
      else if (paramString.charAt(i).equals("u"))
      {
        str = str + "-...";
      }
      else if (paramString.charAt(i).equals("v"))
      {
        str = str + "-.. ";
      }
      else if (paramString.charAt(i).equals("w"))
      {
        str = str + "-. -";
      }
      else if (paramString.charAt(i).equals("x"))
      {
        str = str + "-. .";
      }
      else if (paramString.charAt(i).equals("y"))
      {
        str = str + "- --";
      }
      else if (paramString.charAt(i).equals("z"))
      {
        str = str + "- -.";
      }
      else if (paramString.charAt(i).equals("A"))
      {
        str = str + "- - ";
      }
      else if (paramString.charAt(i).equals("B"))
      {
        str = str + "- .-";
      }
      else if (paramString.charAt(i).equals("C"))
      {
        str = str + "- ..";
      }
      else if (paramString.charAt(i).equals("D"))
      {
        str = str + "- . ";
      }
      else if (paramString.charAt(i).equals("E"))
      {
        str = str + "-  -";
      }
      else if (paramString.charAt(i).equals("F"))
      {
        str = str + "-  .";
      }
      else if (paramString.charAt(i).equals("G"))
      {
        str = str + ".---";
      }
      else if (paramString.charAt(i).equals("H"))
      {
        str = str + ".--.";
      }
      else if (paramString.charAt(i).equals("I"))
      {
        str = str + ".-- ";
      }
      else if (paramString.charAt(i).equals("J"))
      {
        str = str + ".-.-";
      }
      else if (paramString.charAt(i).equals("K"))
      {
        str = str + ".-..";
      }
      else if (paramString.charAt(i).equals("L"))
      {
        str = str + ".-. ";
      }
      else if (paramString.charAt(i).equals("M"))
      {
        str = str + ".- -";
      }
      else if (paramString.charAt(i).equals("N"))
      {
        str = str + ".- .";
      }
      else if (paramString.charAt(i).equals("O"))
      {
        str = str + "..--";
      }
      else if (paramString.charAt(i).equals("P"))
      {
        str = str + "..-.";
      }
      else if (paramString.charAt(i).equals("Q"))
      {
        str = str + "..- ";
      }
      else if (paramString.charAt(i).equals("R"))
      {
        str = str + "...-";
      }
      else if (paramString.charAt(i).equals("S"))
      {
        str = str + "....";
      }
      else if (paramString.charAt(i).equals("T"))
      {
        str = str + "... ";
      }
      else if (paramString.charAt(i).equals("U"))
      {
        str = str + ".. -";
      }
      else if (paramString.charAt(i).equals("V"))
      {
        str = str + ".. .";
      }
      else if (paramString.charAt(i).equals("W"))
      {
        str = str + ". --";
      }
      else if (paramString.charAt(i).equals("X"))
      {
        str = str + ". -.";
      }
      else if (paramString.charAt(i).equals("Y"))
      {
        str = str + ". - ";
      }
      else if (paramString.charAt(i).equals("Z"))
      {
        str = str + ". .-";
      }
      else if (paramString.charAt(i).equals("0"))
      {
        str = str + ". ..";
      }
      else if (paramString.charAt(i).equals("1"))
      {
        str = str + ". . ";
      }
      else if (paramString.charAt(i).equals("2"))
      {
        str = str + ".  -";
      }
      else if (paramString.charAt(i).equals("3"))
      {
        str = str + ".  .";
      }
      else if (paramString.charAt(i).equals("4"))
      {
        str = str + " ---";
      }
      else if (paramString.charAt(i).equals("5"))
      {
        str = str + " --.";
      }
      else if (paramString.charAt(i).equals("6"))
      {
        str = str + " -- ";
      }
      else if (paramString.charAt(i).equals("7"))
      {
        str = str + " -.-";
      }
      else if (paramString.charAt(i).equals("8"))
      {
        str = str + " -..";
      }
      else if (paramString.charAt(i).equals("9"))
      {
        str = str + " -. ";
      }
      else if (paramString.charAt(i).equals("~"))
      {
        str = str + " - -";
      }
      else if (paramString.charAt(i).equals("`"))
      {
        str = str + " - .";
      }
      else if (paramString.charAt(i).equals("!"))
      {
        str = str + " .--";
      }
      else if (paramString.charAt(i).equals("@"))
      {
        str = str + " .-.";
      }
      else if (paramString.charAt(i).equals("#"))
      {
        str = str + " .- ";
      }
      else if (paramString.charAt(i).equals("$"))
      {
        str = str + " ..-";
      }
      else if (paramString.charAt(i).equals("%"))
      {
        str = str + " ...";
      }
      else if (paramString.charAt(i).equals("^"))
      {
        str = str + " .. ";
      }
      else if (paramString.charAt(i).equals("&"))
      {
        str = str + " . -";
      }
      else if (paramString.charAt(i).equals("*"))
      {
        str = str + " . .";
      }
      else if (paramString.charAt(i).equals("."))
      {
        str = str + ".";
      }
      else
      {
        if (!paramString.charAt(i).equals("-"))
          continue;
        str = str + "-";
      }
    return str;
  }




in several of the previous classes it references the objects a and b and c, these are a JPanel, a String, and a array of strings, respectively.
User avatar
WallShadow
Contributor
Contributor
 
Posts: 594
Joined: Tue Mar 06, 2012 9:37 pm
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by moldyToast1 on Sun Jan 06, 2013 12:29 pm
([msg=72087]see Re: My encryption technique [COMPLETED][/msg])

Obfuscated just for you man ;)
(poorly, I might add).
moldyToast1
New User
New User
 
Posts: 10
Joined: Sun Jan 06, 2013 1:06 am
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by WallShadow on Sun Jan 06, 2013 12:34 pm
([msg=72088]see Re: My encryption technique [COMPLETED][/msg])

moldyToast1 wrote:Obfuscated just for you man ;)
(poorly, I might add).


Thanks! I still hate notch for doing the same thing, oh well.

First vuln I found:

capital and lowercase encrypt to the same thing. If this is a hash or a MAC, that is TERRIBLE and insecure. I can forge MACs and hashs easily for many different messages with it.
User avatar
WallShadow
Contributor
Contributor
 
Posts: 594
Joined: Tue Mar 06, 2012 9:37 pm
Blog: View Blog (0)


Re: My encryption technique [COMPLETED]

Post by moldyToast1 on Sun Jan 06, 2013 12:41 pm
([msg=72089]see Re: My encryption technique [COMPLETED][/msg])

yes, unfortunately. This kind of cipher is meant to send messages so usually upper/lower case wouldn't matter.
However, that is the only vulnerability, there are no collisions possible :)
moldyToast1
New User
New User
 
Posts: 10
Joined: Sun Jan 06, 2013 1:06 am
Blog: View Blog (0)


Next

Return to Crypto

Who is online

Users browsing this forum: No registered users and 0 guests