This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!

Koot Jart

Greenhorn
+ Follow
since Sep 25, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Koot Jart

I'm looking for a tool to make comparison between files and folders. There is of course Beyond Compare, but it is not freeware. Is there anything else nearly as good as that? I found a tool called Meld (http://meldmerge.org/), but I'm not too happy about that. It is not so good, when you have to compare two folders, which include big amount of sub-folders and files.

Thanks
Javamies
5 years ago
Thanks Rob!

Rob Prime wrote:First of all, if A = 01 then Z = 26, not 25.



Now a nice little trick. Check the following code:
This works because char is nothing more than an int with range from 0 to 65535 (inclusive) with special representation. Now, how would you turn 'A' (65) into 1, without assuming that 'A' will always be 65? (So no "- 64" allowed)?

Heh, you are right Z = 26

What do you think about this kind of solution:


11 years ago
Hi guys!

I'm doing some cryptography stuff. My aim is to encrypt some text. Before doing any encryption I need to code all characters to some numeric format. Like this

A = 01
B = 02
C = 03
.
.
.
X = 23
Y = 24
Z = 25

I was just wondering, what is the best way to check the text and change it to numeric format. Only options that came to my mind is just to do MANY if and elseif statements, where I can check the characters. Is there any other way or does Java have any tools to do this in more stylish way?

11 years ago
Hi!

I think this is really tough question, but lets try.

I'm implementing small software in J2ME environment. Part of that software is to encrypt a small txt-file using a password based encryption. I'm using SATSA (Security And Trusted Services API, JSR177) for actual encryption. However, I need to generate a key for that encryption process. Key generation must be done using so called "slow funcktion". I have decided to use PBKDF2 algorithm for that purpose (see: http://www.ietf.org/rfc/rfc2898.txt)

At the moment I have started to implement PBKDF2 for J2ME. I can do everything else, but I have a problem creating PRF (Pseudo Random Function), that is used in key generation process. I can' use Mac and SecretKeySpec classes, that are part of JavaSE:

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

Those classes are not in J2ME unfortunately.

Could somebody give me any hint, how I could create my own PRF for J2ME? Which algorithm to use? Are there anything ready for J2ME.

Br
Koot
12 years ago
Hi Henry and others!

I have made a piece of code:



I don't really know if it is working properly or not. Could you now help me, how to convert this byte-table back to long. Then I can see, that everything is all right when converting long to byte originally.

It's funny how hard it seems to be, to find any examples of this.
12 years ago
Hi!

I'm making a small application for J2ME. I need to convert long integer to byte table. Those long integers can very long like this: 3460215174411169804

How can I read this long to this kind of byte-table:

byte table[] = new byte[8];

I would like to see some examples.

Remember, I'm using J2ME, so I don't have all the classes in use, what can be use in J2SE.
12 years ago
Hi Bauke and thanks for your answer!

Bauke Scholtz wrote:You basically want to convert long to byte[]?

Then just do that You know, long is 64bits and each byte can hold 8bits. You need to shift 8bits from the long 8 times and get each of them in the byte array.



Well, basically this is what I need. But how to do it in practice? Do you have or know good examples of this? I'm not so familiar with byte-operations.

Those other alternatives are good options, but I guess they are not available in J2ME.



12 years ago
Hi!

I'm making a small application for J2ME. I need a very random seed for a certain key. For that seed I have created a very long long Those long's can be like this 3460215174411169804

How can I read this long to this kind of byte-table:



Remember, I'm using J2ME, so I don't have SecureRandom-class in use, which could be used with Java SE for this kind of purposes to make random byte-tables.

Br
Koot
12 years ago
Thanks Henry and Rob!

Actually that Henry's example won't work. As Rob said, result of that ^ operation is not byte. It is just funny, that operation



actually does casting also.

Br
Koot
12 years ago
Hi All!

I have here a little piece of code:



This code is actually doing XOR-operation for these two byte tables. I think... But a little piece of code, what I don't properly understand is this



Could somebody "write out", how it is actually working.

Thanks in advance!
12 years ago
Hi!

I'm implementing a small application with J2ME. There is a need to encrypt data in that application and encryption is based on key that is generated from password. For that key generation I would like to use PBKDF2 algorithm.

Matthias G�rtner has implemented PBKDF2 for Java SE, but I couldn't find any implementation for J2ME. Here is implementation for Java SE:

http://www.rtner.de/software/PBKDF2.html

Does somebody know J2ME implementation for PBKDF2? It would help me a lot. Of course other option is porting this Java SE implementation to J2ME.

Br
Koot
12 years ago

Please remember that this is an English only site. If you post something in another language, at MINIMUM, you must provide a translation. In any case, non-English posts are subject to deletion.



Sorry about this. I was not saying anything mean. Only just Merry Christmas and thanking Henry for his answers.

Br
Uuno
[ December 17, 2008: Message edited by: Koot Juurt ]
12 years ago
Thanks for your answers guys. Those make things clearer for me. One question to Pat:

But it has to be a strong key, using a password in ASCII doesn't cut it. You have to take the user's input and make it strong, usually by running it through a hash such as SHA1.



I don't quite understand this. If I use SHA1 to make a "hash", why can't possible attacker do the same? Attacker can read source code, he knows what I'm using. How does this help me?

Currently what I'm doing is, that I take password as seed, run it through method that makes it 32 characters long "random" string and do encrypting after that with Java's crypto package. I think encrypting is now 32*8=256 bytes.

Br
Uuno
12 years ago
Henry, one more thing:

Hyv�� Joulua ja Onnellista Uutta vuotta!

Pid� lippu korkealla tulevaisuudessakin ja vastaile tyhmiin kysymyksiin yht� k�rsiv�llisesti kuin teit minunkin kanssani.

Parhain Terveisin
Uuno
12 years ago
Hi Henry!

You didn't really get to the point all that quick. The original topic was about salting the keys to the AES algorithm, and how would that improve security.



Well yes. I mean that I was talking all the time password attack. Not any other kind of attacks.
12 years ago