Results 1 to 6 of 6
Thread: simple porting (from c) problem
- 01-05-2011, 10:10 PM #1
Member
- Join Date
- Jun 2010
- Posts
- 6
- Rep Power
- 0
simple porting (from c) problem
The bottom line is that I'm having trouble porting code because of the c (the language c) stream operator "<<".
here is the code I'm having trouble with:I really need to know what this code does, Thanks in advance.;)Java Code:#define xtime(x) ((x<<1) ^ (((x>>7) & 1) * 0x1b))
- 01-05-2011, 11:32 PM #2
Senior Member
- Join Date
- Dec 2010
- Posts
- 165
- Rep Power
- 3
there are bit operators
- 01-06-2011, 01:03 AM #3
Funny guys, those C-programmers!
I'm no C guru (anymore. It's too long ago, so don't take me too seriously).
Operatoroverloading is c++ (i.m.h.o.), so JavaHater is right: << is a shift-operator.
^ bitwise OR, & bitwise AND, * times. I guess 0x1b is ASCII 27, ESCAPE (00011011).
Further I'm at a loss: maybe a very concocted way to check if the escape has been pressed.
- 01-06-2011, 02:40 AM #4
Member
- Join Date
- Jun 2010
- Posts
- 6
- Rep Power
- 0
No, this code has nothing to do with the keyboard. It's part of the AES encryption cipher.
Thank you very much. I think this is all I need.:)
- 01-07-2011, 05:10 AM #5
Member
- Join Date
- Jan 2011
- Posts
- 12
- Rep Power
- 0
the provided define can be directly translated to java, same operators in java do the same thing.
- 01-07-2011, 07:04 PM #6
Member
- Join Date
- Jun 2010
- Posts
- 6
- Rep Power
- 0
Alright, the AES (Rijndael) encryption code I ported from c is not working correctly and I'm wondering of anyone knows where to find AES code in java I can look at.
My goal is not simply to encrypt data but to learn how the cipher works. Then I want to be able to modify the cipher code and play around with it.
Similar Threads
-
Porting a Netbeans project with .form files to Eclipse
By nds in forum EclipseReplies: 0Last Post: 12-28-2010, 09:05 AM -
Very simple problem
By Andyj in forum Java CertificationReplies: 3Last Post: 09-17-2010, 06:49 AM -
I have a simple problem
By o0oNorao0o in forum JCreatorReplies: 20Last Post: 12-25-2009, 08:32 PM -
simple line problem / for loop problem
By helpisontheway in forum New To JavaReplies: 1Last Post: 11-17-2009, 06:12 AM -
Porting to a Nokia Device
By David55 in forum CLDC and MIDPReplies: 1Last Post: 06-30-2008, 01:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks