# Java + Cryptography

• 04-01-2012, 11:19 PM
Pretender
Java + Cryptography
Hello Everybody,

I was signing up to another forum for java then it gave me questions to complete my registration.
(I couldn't answer so I came here looking for another forum :P)
But here is the question:
Code:

int l = 2;
int y = "QCZ".hashCode() % 3000;
int u = "KRL".hashCode() % 3000;
for (int q = 0; q <= u; q++)
l = (l ^ q) % y;
return l;

Question 1: What is the returned value?

Question 2: What is the greatest common divisor of the previous two results?

So the returned value would be 2, right?

Okay, but about the code in General: hash.Code()
I take it this has done a little 'crypt' in a hash right?
So this means Cryptography is possible in Java...
I am wondering if Java is powerful enough to create a FUD Crypter?

But also I am curious about question 2, if anybody could help me I would enjoy that :3

I'm not sure where this should go so I put this thread here.
Thanks, Pretender.
• 04-02-2012, 12:11 AM
pbrockway2
Re: Java + Cryptography
Quote:

Question 1: What is the returned value?
The easiest way is to write some code and see.

Code:

public class Foo {
public static void main(String[] args) {
int l = 2;
int y = "QCZ".hashCode() % 3000;
int u = "KRL".hashCode() % 3000;
for (int q = 0; q <= u; q++) {
l = (l ^ q) % y;
}
//return l;
System.out.println(l);
}
}

In Java hashCode() returns an integer value can be "associated" with whatever it is called on. It has some reliable properties described in the Object API docs - and the particular int returned for strings like "QCZ" is described in the String documentation.

There's a bit of an introduction to hash values and what they might be used for in Wikipedia.

Quote:

Question 2: What is the greatest common divisor of the previous two results?
What are the previous two results?
• 04-02-2012, 12:24 AM
Pretender
Re: Java + Cryptography
But can I ask - Does this mean its possible to make a crypter in Java?
• 04-02-2012, 02:04 AM
pbrockway2
Re: Java + Cryptography
There are encryption libraries and software written in Java. And I guess you could write your own. The prerequisites would seem to be a reasonable grasp of basic Java (easy) and as much mathematics as you care to throw at the problem (unboundedly difficult, but fun).

A little googling reveals that FUD=="fully undetectable" and that the aim seems to be to encrypt executables to make malware undetectable by the end user. If that's your aim - and I hope not - this is probably not the right place to get help, as most here would regard that as a waste of effort (and talent, although judging from the sites distributing this stuff most of the 1337ness seems to reside in passing on and "modding" other people's efforts.)