Forum: Java May 9th, 2009 |
| Replies: 8 Views: 2,263 Yes, the key HAS to be of a certain length. In this case, you're asking for 128-bit encryption, so your key as to be (128/8) = 16 bytes long.
Normally, an encryption key is essentially "random"... |
Forum: Java May 9th, 2009 |
| Replies: 8 Views: 2,263 The key is simple a sequence of 16 random bytes created by the KeyGenerator. It's actually the same 16 bytes as returned by getEncoded() -- your raw[] array in this case.
If you want to use some... |
Forum: Java May 4th, 2009 |
| Replies: 1 Views: 279 OK, so the basic idea is that you can use sine and cosine to convert from an angle to a position on the screen. If r is the radius, then the (x) and (y) coordinates are r * Math.sin(angle) and r *... |
Forum: Java Apr 7th, 2009 |
| Replies: 17 Views: 1,186 As people have mentioned, you need to use asymmetric encryption at the very start of the conversation to send the sessiion key to the server. Use RSA for this. Essentially, you create a... |
Forum: Computer Science Dec 29th, 2008 |
| Replies: 3 Views: 1,131 For more effective programming, don't try and memorise this list; bracket expressions appropriately so that any programmer can read them whether or not they have also memorised this list (practically... |
Forum: Java Dec 29th, 2008 |
| Replies: 8 Views: 652 You don't actually have to go to all that trouble, though...
int val = Integer.parseInt(str, 2);
float f = Float.intBitsToFloat(val); |
Forum: Java Dec 14th, 2008 |
| Replies: 7 Views: 566 There's nothing wrong with it per se -- it's a very powerful component -- but it's not designed for what you're trying to do. It is designed for cases where you want to run code in some arbitrary... |
Forum: Java Dec 11th, 2008 |
| Replies: 5 Views: 449 OK, so in this specific example, absolutely any sequence of bytes can be a valid string. So when you read a string from the file-- I assume you're thinking of one "string" per line, so you'd... |
Forum: Java Dec 11th, 2008 |
| Replies: 4 Views: 802 In linear probing, you do indeed just try the next space and so on. If you use linear probing (or indeed any type of probing to resolve collisions) then you have to think about strategies to avoid... |