Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 18
1  Game Development / Newbie & Debugging Questions / Re: Mouse input, finding tile below mouse. on: 2014-10-21 14:56:05
try performing some division , this is an issue I had and it seemed that one of the variables was twice what it should be for that function. it does seems to look like its * 2 so do
1  
2  
tileX = ((mouse.getX() + xScroll)/32)/2;
tileY = ((mouse.getY() + yScroll)/32)/2;
2  Game Development / Game Mechanics / Re: Implementing a 2D city map with (mostly) free movement on: 2014-10-21 14:53:37
The map does contain tiles and its difficult to see but the players are following the tiles , they just flow across them. Should be fairly simple to implement , it seems to zoom in.
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Announce Pure Java HIDAPI on: 2014-10-20 16:35:46
This is absolutely awesome. It seems likes you are interacting with the kernel which takes a lot of skill, and you did it well. +1
4  Discussions / General Discussions / Re: development block on: 2014-10-20 14:43:23
I think ill just let it settle down for a week , go back to programming in c++. Great book c++ primer 5th edition for anyone who wants to learn it.
5  Discussions / General Discussions / development block on: 2014-10-19 13:19:12
It's weird, I know what I want to implement however im stuck trying to figure out what I need to implement , I have a lot of options but then I get stuck because I have to implement something else that requires something else.
6  Games Center / Featured Games / Re: Daedalus - no escape on: 2014-10-19 11:49:37
I thought I might try your game but I couldn't open the zip file... I will try to find a way to fix corrupted files but maybe you should look into this...

I am using a Lenovo E530 with Windows 8.1 installed... I have tryed both normal windows and 7-Zip to open the file...
Windows says that it cannot open the file because it is invalid...
And 7-Zip says that it cannot open it as a zip file...

Plz fix this... thx in advance...

EDIT: I have used a repair tool to fix it but their was still one broken file...

EDIT 2: Couldn't run it after extracting it...
Have you tried running it through he console to see if it returned an exception?
7  Game Development / Newbie & Debugging Questions / Re: Orbital Mechanics / Velocity on: 2014-10-18 17:12:00
 V = sqrt(GM/r)  , off google where V = velocity required to sustain orbit G is gravitational constant, M is the mass of the central object , and R is the radius from the center of the orbit. you can recalculate R each time . meaning say velocity is too low them recalculate when R is , then reinput R into the equation to obtain the new value.
8  Discussions / General Discussions / Re: painful maths that will hurt your brain... on: 2014-10-16 21:39:03
No not to crack it , I was just attempting to see how to derive to try and further understand how the functions actually work. It's an interesting topic that is very useful these days.
9  Discussions / General Discussions / Re: RSA direct bypass on: 2014-10-16 21:37:41
What I mean was if the length of the data you were transmitting using my method was small enough a simple pc could crack it , sending 8 encoded chars per encryption would yield 255^8 different combinations that would need to be tried. If you did this with a bigger number such as 64 bytes then thats 255^64 which would be horrendous to attempt to crack , the only ,method for it would be brute force.
10  Game Development / Game Mechanics / Re: Collision and gravity on: 2014-10-16 17:37:53
Basically the issue is you are checking collision around the person entirely and then setting falling to 0 , to ensure this doesnt happen split it up so you check upward downward left and right collsions seperately , you can then use the booleans of these to check if they are falling or not. hope this helps.
11  Game Development / Newbie & Debugging Questions / Re: Easy way to achieve lighting on: 2014-10-16 17:29:04
You basically described it , change the alpha per level and bam you got it.
12  Discussions / General Discussions / Re: RSA direct bypass on: 2014-10-16 15:57:08
Ok , well from longarmx I took the idea and have begun making the encryption so that the data is not the int value of the char so A 65 , if I was sending ABCD the data I would encrypt would be 65666768 , which would be decoded , I can see how this is exponentially more secure, you would need to perform 65666768 combinations with a total of 99^4 different solutions to value within 100 , if padding was added as you said and then the data was encrypted in a way to make it as difficult as possible , such as a password say password which would be  11297115115119111114100 this is then put into the RSA code instead of each character, it is then dissected upon decryption where each character is equal to (int)(data / (n * 1000))  (I think), where N is the character position in the word , its maximum can be resolved to string.length / 3(each has a max of 255 so you can divide). Still there are flaws in this , if the data is short say Ok or a simple word then the decryption could take seconds due to the combinations , if some complex math was used knowing the logic behind how it works the value could be resolved. Thanks for the info.
13  Discussions / General Discussions / Re: RSA direct bypass on: 2014-10-15 20:17:26
So give me a form of RSA encryption that is stronger. I am interested in this and want to see what you are talking about.
14  Java Game APIs & Engines / OpenGL Development / Re: Draw Order and Scene Graphs on: 2014-10-15 19:17:33
this is the reason why opengl is so useful , that code is just annoying to setup and inefficient to run.
15  Discussions / General Discussions / Re: RSA direct bypass on: 2014-10-15 16:19:09
http://pastebin.java-gaming.org/3f9d315161d11
16  Discussions / General Discussions / Re: RSA direct bypass on: 2014-10-15 16:09:25
Is there a TL;DR version which just includes the maths and none of the UI or debug output?

That said, there are known weaknesses in the simple version of RSA which is presented in introductory number theory lessons.

Sure ill just create the code in a sec and send you the pastebin.

Yes I can see the situation in those links however the point to this is that no matter how hard it is to decrypt if you are able to recover data at all you are closer to the solution , so for instance if the data was pre encrypted with another key then patterns can be seen in the code allowing for it to be checked over. As said if it uses multiple layers of encryption its more difficult this just removes the main level. With something such as padding it only makes the data difficult to interpret when it is in the encrypted form outside of that the padding is easy to spot. I think that main thing that needs to happen now is dynamic cryptography , where the data is manipulated so that it looks like something that its not such as hiding a simple encryption as a series of hashes.

In bank security it is most likely that all data is hashed within the client and then RSA encrypted meaning that only with access to the server would you be able to confirm it.However all other information would have to be sent in standard text , you would be able to monitor what they were doing.
17  Discussions / General Discussions / Re: RSA direct bypass on: 2014-10-15 15:28:37
This is why they use one-time keys.

Still from that data , ie you intercept it you can obtain the password and login sent. Changing the key doesnt change the data that they sent.
18  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-14 19:44:33

Quote
` The Fibonacci sequence: (loosely defined as all F(x) where x < 2 is 1)
[dup [drop 1] [dup 2 - fib swap 1 - fib +] 2 < if] /fib def

` execution stack of fib(2):

2 fib
2 dup [drop 1] [dup 2 - fib swap 1 - fib +] 2 < if
2 2 [drop 1] [dup 2 - fib swap 1 - fib +] 2 < if
2 [drop 1] [dup 2 - fib swap 1 - fib +] 2 2 < if
2 [drop 1] [dup 2 - fib swap 1 - fib +] false if
2 dup 2 - fib swap 1 - fib +
2 2 2 - fib swap 1 - fib +
2 0 fib swap 1 - fib +
2 0 dup [drop 1] [dup 2 - fib swap 1 - fib +] 2 < if swap 1 - fib +
2 0 0 [drop 1] [dup 2 - fib swap 1 - fib +] 2 < if swap 1 - fib +
2 0 [drop 1] [dup 2 - fib swap 1 - fib +] 0 2 < if swap 1 - fib +
2 0 [drop 1] [dup 2 - fib swap 1 - fib +] true if swap 1 - fib +
2 0 drop 1 swap 1 - fib +
2 1 swap 1 - fib +
1 2 1 - fib +
1 1 fib +
1 1 dup [drop 1] [dup 2 - fib swap 1 - fib +] 2 < if +
1 1 1 [drop 1] [dup 2 - fib swap 1 - fib +] 2 < if +
1 1 [drop 1] [dup 2 - fib swap 1 - fib +] 1 2 < if +
1 1 [drop 1] [dup 2 - fib swap 1 - fib +] true if +
1 1 drop 1 +
1 1 +
2

I may have to write an implementation...
What is it with you and constantly using lisp syntax that makes my brain go ow?
Is it that you want to hurt me.

PS programmer dubstep just here , just saying.
19  Discussions / General Discussions / RSA direct bypass on: 2014-10-14 16:52:33
So , I have sort of came up with a way to directly bypass the RSA encryption with relatively little computational effort. So in the form of a MITM attack (man in the middle) where all he knows is the public key , how do you effectively decrypt there message? you would assume you would need to know the private key in order to decrypt using the function encrypted_var^privatekey mod sum_of_primes. However that takes effort , a lot of effort , especially with the banks using 2048bit (671 digit long) codes. So that obviously wont work unless you have a couple of super computers to hand however what if you pregenerate the keyset IE you have monitored the traffic and you know what the public key is , you then take this and you apply it to every character in the ascii key set. so a b c d e f g on and on until you have the value for each , during the transmission you then check this against the message they are sending and you can effectively decrypt using fairly little computational effort, if they are sending a relatively long message say a few thousand characters like a resume then you will use less effort calculating the values than they did actually encrypting their data.
So using my little RSA algorithm , it doesnt use very large numbers as I didnt want to use biginteger however it is still viable to use to test.
 Here is the code for calculating an RSA encryption from the given keys:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
258  
259  
260  
261  
262  
263  
264  
265  
266  
267  
268  
269  
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigInteger;
import java.util.Random;

import javax.swing.JOptionPane;
import javax.swing.filechooser.FileFilter;

public class Encryptor {
   

   public Encryptor() {
      long[] key = new long[4];
      boolean newkeys = JOptionPane.showConfirmDialog(null,
            "Generate new keys?") == JOptionPane.YES_OPTION;
      if (newkeys) {
         key = calculate_key(generateprimelong(), generateprimelong());
         JOptionPane.showMessageDialog(null, "Your public key is: " + key[0] + "," + key[1]);
         JOptionPane.showMessageDialog(null, "Your private key is: " + key[2] + "," + key[3]);
         
      }
      else{
     
         
      }
      if (JOptionPane.showConfirmDialog(null,
            "Are you decrypting?")== JOptionPane.YES_OPTION) {
         if(!newkeys){
            String privatekey = JOptionPane.showInputDialog("Please enter you private key in the form a,b");
            String[] pks = privatekey.split(",");
            key[2] = Long.parseLong(pks[0]);
            key[3] = Long.parseLong(pks[1]);
         }
         String decryptlocation = JOptionPane
               .showInputDialog("Please enter the file location of your encrypted text file");
         try {
            decrypt(key[2],key[3],read(decryptlocation));
         } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }
      } else {
         if(!newkeys){
            String publickey = JOptionPane.showInputDialog("Please enter your public key in the form a,b");
            String[] pls = publickey.split(",");
            key[0] = Long.parseLong(pls[0]);
            key[1] = Long.parseLong(pls[1]);
         }
         String fileloc = JOptionPane
               .showInputDialog("Enter the location of your unencrypted text file");
         try {
            String data = readstring(fileloc);
            encrypt(key[0],key[1],data);

         } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }
      }
   }

   public static void main(String[] args) {
      new Encryptor();

   }

   private static Random r = new Random();

   public static long generateprimelong() {

      boolean testing = true;

      while (testing) {
         long num = Math.abs(r.nextLong()) / 900000000000000l;
         if (!isprime(num)) {
            continue;
         }
         testing = false;
         return num;

      }
      return 0l;
   }

   public static boolean isprime(long n) {
      if (n <= 3) {
         if (n <= 1) {
            return false;
         } else {
            return true;
         }
      }
      if (n % 2 == 0 || n % 3 == 0) {
         return false;
      }
      for (int i = 5; i < Math.sqrt(n) + 1; i += 6) {
         if (n % i == 0 || n % (i + 2) == 0) {
            return false;
         }
      }
      return true;
   }

   public static int generateprimeshort(int max) {
      boolean testing = true;

      while (testing) {
         int num = Math.abs(r.nextInt(max));
         if (!isprime(num)) {
            continue;
         }
         testing = false;
         return num;

      }
      return 0;
   }

   public long[] calculate_key(long P, long Q) {
      long n = P * Q;
      long tonient_n = (P - 1) * (Q - 1);
      long e = generateprimeshort(Math.abs((int) (Math.sqrt(n))));
      long d = findInverse(e, tonient_n);
      long[] keys = new long[4];
      keys[0] = n;
      keys[2] = n;
      keys[1] = e;
      keys[3] = d;
      // encrypt(n, e,
      // "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
      return keys;
   }

   public static long findInverse(long a, long b) {
      long calculate = b;
      long x = 0, y = 1, lastx = 1, lasty = 0;
      while (b != 0) {
         long quotient = a / b;

         long temp = a;
         a = b;
         b = temp % b;

         temp = x;
         x = lastx - quotient * x;
         lastx = temp;

         temp = y;
         y = lasty - quotient * y;
         lasty = temp;
      }

      // int[] coefficients = {lastx, lasty, a};
      return calculate + lastx;
   }

   public void encrypt(long a, long b, String information) {
      long[] value = new long[information.length()];

      for (int i = 0; i < information.length(); i++) {
         char letter = information.charAt(i);
         int lettercode = letter;
         value[i] = powmod(lettercode, b, a);
      }
      try {
         write(value);
      } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
   }
   public void decrypt(long a , long b , long[] data){
      String datastring= "";
      for(int i = 0; i < data.length;i++){
         long value = powmod(data[i],b,a);
         System.out.println(value);
         datastring += (char)value;
      }
      try {
         writestring(datastring);
      } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
     
     
   }

   public static long powmod(long base, long exponent, long modulus) {
      if (exponent < 0)
         throw new IllegalArgumentException("exponent < 0");
      long result = 1;
      while (exponent > 0) {
         if ((exponent & 1) != 0) {
            result = (result * base) % modulus;
         }
         exponent >>>= 1;
         base = (base * base) % modulus;
      }
      return result;
   }

   public static void write(long[] content) throws IOException {
      File file = new File("Encrypted.txt");
      if (!file.exists()) {
         file.createNewFile();
      }

      FileWriter fw = new FileWriter(file.getAbsoluteFile());
      BufferedWriter bw = new BufferedWriter(fw);
      for (int i = 0; i < content.length; i++) {
         try {
            bw.write(Long.toString(content[i]) + ";");
         } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }
      }
      bw.close();

   }
   public static void writestring(String content) throws IOException {
      File file = new File("unencrypted.txt");
      if (!file.exists()) {
         file.createNewFile();
      }

      FileWriter fw = new FileWriter(file.getAbsoluteFile());
      BufferedWriter bw = new BufferedWriter(fw);
      bw.write(content);
      bw.close();

   }

   public static long[] read(String location) throws IOException {
      File file = new File(location);

      if (!file.exists()) {
         System.out.println("NO FILE LOCATED");
         return null;
      }
      FileReader fr = new FileReader(file.getAbsoluteFile());
      BufferedReader br = new BufferedReader(fr);
      String filedata = br.readLine();
      String[] info = filedata.split(";");
      long[] data = new long[info.length];
      for (int i = 0; i < info.length; i++) {
         data[i] = Long.parseLong(info[i]);
      }
      return data;
   }

   public static String readstring(String location) throws IOException {
      File file = new File(location);

      if (!file.exists()) {
         return null;
      }
      FileReader fr = new FileReader(file.getAbsoluteFile());
      BufferedReader br = new BufferedReader(fr);
      String filedata = br.readLine();
      return filedata;
   }

}


Here are the keys it generated for me public key: modulo =  4127353, exponent = 1193 private key: inverse modulo of the totient of n and e = 3853577.
So ill encrypt some data , just a simple sentence.

Hi there my pseudonym is lcass <- hazzah , so what does this code output.

tada:
1  
110284;3066158;2777967;1857537;3770054;2342914;1419964;2342914;2777967;2041712;179304;2777967;2630803;1377978;2342914;2399661;3956477;461248;3312036;179304;2041712;2777967;3066158;1377978;2777967;1251139;133099;3923355;1377978;1377978;


So the algorithm works , it provides a seemingly impossible to solve output with only the public key known. The code to crack this is horrendously simple , a primary school student could learn to do write it.

So whats the output from my software (currently)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
227  
228  
229  
230  
231  
232  
233  
234  
235  
236  
237  
238  
239  
240  
241  
242  
243  
244  
245  
246  
247  
248  
249  
250  
251  
252  
253  
254  
255  
256  
257  
1 
3361614 
524989 
3812176 
3017243 
3757682 
1115560 
481481 
1198840    
1406822

3021519
1123717
4100787

2196864 
3214222 
3536678 
1087018 
3184147 
2770508 
1298307 
1847552 
97787 
1113478 
748930 
3280713 
3026690 
1881143 
2093244 
2655181 
1019726 
2347297 
2777967  
2787154 !
3585267 "
1446638 #
4117764 $
2058807 %
2308059 &
3595366 '
3595296 (
2589501 )
2548941 *
2037439 +
3245886 ,
65685 -
3307204 .
2032884 /
2535374 0
2891746 1
1294485 2
4030257 3
2720298 4
3932494 5
2274088 6
2906303 7
3734352 8
2899859 9
3844924 :
3708039 ;
1691850 <
1540648 =
4100487 >
12516 ?
2917410 @
1245075 A
1082729 B
2536003 C
245638 D
2568999 E
1390894 F
1300269 G
110284 H
3676029 I
3829978 J
2084963 K
3037529 L
361130 M
1706999 N
2292876 O
1653140 P
2865999 Q
1658786 R
3976913 S
1701301 T
517277 U
1186285 V
1634613 W
2858905 X
969002 Y
2484796 Z
2554933 [
2042631 \
1319523 ]
1514145 ^
2744424 _
1934813 `
3923355 a
2194206 b
133099 c
3956477 d
2342914 e
57002 f
3985480 g
3770054 h
3066158 i
3197498 j
2733213 k
1251139 l
2041712 m
3312036 n
461248 o
2630803 p
3048649 q
1419964 r
1377978 s
1857537 t
2399661 u
1783764 v
979268 w
2796608 x
179304 y
3558530 z
264055 {
1616622 |
3342005 }
3851695 ~
3002970 
596143 ?
641750 ?
3675516 ?
2708598 ?
2466850 ?
2794255 ?
3185283 ?
3995503 ?
1261787 ?
3550272 ?
388952 ?
3754967 ?
1660984 ?
3181595 ?
3571870 ?
3214743 ?
1009857 ?
2037687 ?
739687 ?
3605628 ?
1442762 ?
2275239 ?
1077450 ?
1469684 ?
2982160 ?
2604959 ?
1325930 ?
1042997 ?
478427 ?
3772141 ?
2499365 ?
1739907 ?
1904052  
3995565 ¡
1310958 ¢
2156012 £
4007602 ¤
2012745 ¥
3352930 ¦
2850885 §
1047128 ¨
4102346 ©
2894707 ª
3413089 «
304802 ¬
89407 ­
3038244 ®
978002 ¯
1866876 °
1262062 ±
517803 ²
3879004 ³
401403 ´
3087098 µ
3009749 ¶
2394874 ·
110336 ¸
2975568 ¹
2938080 º
1206767 »
3744546 ¼
16348 ½
3582968 ¾
1465072 ¿
1115779 À
4005093 Á
1295531 Â
1784565 Ã
2642477 Ä
124753 Å
1759821 Æ
1950156 Ç
1072558 È
1039698 É
669182 Ê
2326498 Ë
2230850 Ì
244389 Í
1630834 Î
1076201 Ï
3803297 Ð
3933522 Ñ
1012112 Ò
2918393 Ó
62403 Ô
4009371 Õ
3388657 Ö
3908357 ×
3506345 Ø
1058706 Ù
2174467 Ú
2945588 Û
100071 Ü
1368753 Ý
2650703 Þ
3993333 ß
3012647 à
370101 á
2693719 â
3591687 ã
442983 ä
471566 å
2808120 æ
3444868 ç
502782 è
3314998 é
50533 ê
324629 ë
285518 ì
430620 í
2048694 î
101233 ï
1163385 ð
3946168 ñ
459242 ò
3794920 ó
2138401 ô
4082221 õ
1811825 ö
1770521 ÷
2344279 ø
1681848 ù
3878013 ú
2054449 û
994136 ü
3771897 ý
1568825 þ
1416965 ÿ


checking it the output from my RSA "H" is the same as the interpreter.
Now to get it to decrypt an entire message.

And whats the output?

Hi there my pseudonym is lcass
Here is the cracking code.


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
import javax.swing.JOptionPane;
public class RSA {
   int[] ASCII_CHAR_SET = new int[256];//I dont know the actual length so just have it like this
   char[] DATA_COMPARE = new char[256];//the data to reference , random access abit easier than char casting
   public RSA(){
      System.out.println("RSA HACKER STARTED");
      String key = JOptionPane.showInputDialog("What is the public key , enter in the form n,e");
      String[] public_key = key.split(",");//split string where public_key[0] = n and public_key[1] = e
      System.out.println("Key accepted , preparing to generate keyset");
      //convert both to their integer counterparts
      int sum_n = Integer.valueOf(public_key[0]);
      int exponent = Integer.valueOf(public_key[1]);
      //perform the key set generation
      for(int i =0; i < ASCII_CHAR_SET.length;i++){
         ASCII_CHAR_SET[i] = powmod(i,exponent,sum_n);
         char current = (char)i;//should be able to convert from int to char
         DATA_COMPARE[i] = current;//fairly simple assign the character to this
         System.out.println(ASCII_CHAR_SET[i] + " " + current);
      }
      String data = JOptionPane.showInputDialog("What is the data you wish to decrypt");
      String[] seperated_data = data.split(";");
      String output = "";
      for(int i = 0;i < seperated_data.length;i++){
         int value = Integer.valueOf(seperated_data[i]);
         for(int j = 0;j < ASCII_CHAR_SET.length;j++){
            if(ASCII_CHAR_SET[j] == value){
               output+= DATA_COMPARE[j];
               
               break;
            }
         }
      }
      System.out.println(output);
   }
   public static int powmod(long base, long exponent, long modulus) {
      if (exponent < 0)
         throw new IllegalArgumentException("exponent < 0");
      long result = 1;
      while (exponent > 0) {
         if ((exponent & 1) != 0) {
            result = (result * base) % modulus;
         }
         exponent >>>= 1;
         base = (base * base) % modulus;
      }
      return (int)result;
   }//very large numbers so a very annoying method must be required.
   public static void main(String[] args){
      new RSA();//static tags become annoying after some time
   }
}



Enjoy.
20  Discussions / Miscellaneous Topics / Re: annoying c++ issue. on: 2014-10-14 16:11:34
In the header for source one, change to

namespace a { extern int d; };

In C++ "int d" is actually a definition not a declaration even though you don't give it a value (it gets undefined value). Saying extern tells it just to declare and it will be defined (i.e. the memory allocated) elsewhere - in source two in this case.

Ahh thanks , I remember reading that you needed extern somehwhere.
21  Discussions / General Discussions / Re: painful maths that will hurt your brain... on: 2014-10-12 19:59:11
This is for calculating the reverse multiplicative modulo inside an RSA encryption function , a step by step thing is what im looking for.
22  Discussions / Miscellaneous Topics / [solved]annoying c++ issue. on: 2014-10-12 19:35:04
I know this is javagaming.org but would one of you be able to help me with this annoying issue.
I am trying to use a namespace from one class in another class ive defined it within a header

namespace a { int d; };

this is defined within source two as

namespace a {
int d = 5;
};

however I get duplicate definitions.

When I remove the int d from the namespace it dosnt work.
its probably a simple mistake if someone could help with it.
23  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > GREENLIT + FUNDED!!!! WOooOOOoooOooOoo! < on: 2014-10-12 12:50:23
this is great , it is lovely to see that someone who has put in tones of effort is getting something back from i , especially knowing they are trusting unlike other kickstarter projects cough 7framed cough. I know this is going to go well. the next four years will be the rpc years , like the last 4 were the minecraft years.
24  Discussions / General Discussions / Re: painful maths that will hurt your brain... on: 2014-10-12 09:52:40
it is 7 = (log x (28274625))%17   If I give you the clue that 282724625 is 65^3 would that help , so for calculating the inverse of the modulus. Some steps would be very useful , thanks.
25  Discussions / General Discussions / painful maths that will hurt your brain... on: 2014-10-12 00:37:30
So , im working with logarithms and modulus all in one brain hurtingly go. I currently have 7 = log x (274625) % 17 how would I derive the base (x) from that equation. I am utterly butterly lost and cant think of anything apart from rhyming words and sleep.
26  Discussions / General Discussions / Re: Worried on: 2014-10-10 20:13:30
Learning multiple languages is handy because it reveals the patterns that are common to programming. For instance one of the basic things you do in most languages is read data in from a file / file system. Once you have a catalog of the ~10 most common things you need to do to accomplish X picking up a new language and getting to X is usually a matter of a few checks in a book or online reference and off you go. Syntax may change, but essential programming concepts are shared across a large cross-section of the implementation details in any given language of a given class (imperative, functional, etc. etc.)

I agree with this , I am currently finding c++ very easy to learn and can actually remember a lot of it because I can see the similaritys between it and java , this is also why I had such an issue with learning python , it had such wildly different standards and syntax/structure than other languages. However after a while I did begin to see similaritys and really got into it , then I found its HORRENDOUS inefficiency and just sort of left it to die.
27  Discussions / General Discussions / The point at which the percentage of two incrementing variables becomes equal on: 2014-10-10 20:08:09
So , currently I am doing some litecoin mining , some of you may have done this. When I was looking at the share figures I was having a thought in my mind, there are two constantly increasing numbers , currently 15,223,520 and 634,413,584 , if the first number increases by 26000 per minute and the second one increases by 200000 per minute at what point will the percentage of the first number to the second number plateau? By this I mean where the incrementation amounts become enough to keep the percentage of the first number to the second number equal.   
28  Game Development / Game Mechanics / Re: 2D side-scrolling water method on: 2014-09-20 12:18:11
Do you mean like terraria style water?
29  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-09-17 19:33:35
I (hackishly) changed the basic setup of Core's in Mercury (JGO Post Here).
Pretty good stuff.

Old boilerplate code would normally look like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
public class MyClass extends Core {
    Runner runner = Runner.getInstance();

    public MyClass() {
        super("Example");

        runner.init(this, 800, 600, false);
        runner.run();
    }

    public void init()              {}
    public void update(float delta) {}
    public void render(Graphics g)  {}
    public void cleanup()           {}

    public static void main(String[] args) {
        new MyClass();
    }
}

Now it looks like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
public class MyClass extends Core {
    public MyClass() {
        super("Example", 800, 600, false);
    }

    public void init()              {}
    public void update(float delta) {}
    public void render(Graphics g)  {}
    public void cleanup()           {}

    public static void main(String[] args) {
        new MyClass().run();
    }
}

You can read more about this here. Not the biggest change in the world, but still neat IMO.

I actually did this two days ago, but I figured I might as well post about it. Smiley

- Jev
With java about to implement lambda you could utilize this to make your widgets and function calling classes much cleaner (more of an internal upgrade , isntead of nested ifs),such as buttons or clickables , maybe even certain interactions from objects.
30  Discussions / General Discussions / Re: Microsoft to buy Mojang for $2 billion? on: 2014-09-16 21:13:52
He has worked almost independently until he began making money off of it which is quite a feat especially as he then sacrificed his career to give this chance a go.
Pages: [1] 2 3 ... 18
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (45 views)
2014-10-17 03:59:02

Norakomi (35 views)
2014-10-16 15:22:06

Norakomi (27 views)
2014-10-16 15:20:20

lcass (31 views)
2014-10-15 16:18:58

TehJavaDev (61 views)
2014-10-14 00:39:48

TehJavaDev (61 views)
2014-10-14 00:35:47

TehJavaDev (51 views)
2014-10-14 00:32:37

BurntPizza (67 views)
2014-10-11 23:24:42

BurntPizza (39 views)
2014-10-11 23:10:45

BurntPizza (81 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!