Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

How can you xor ArrayLists?

Thread view: 
cryptogirl - 24 Feb 2006 16:42 GMT
Can you xor Arraylist together?  by using the ^ notation. I know the ^
is for integer representation so if i type cast it to Arraylist would
that be sufficient?

Thank you
Robert Klemme - 24 Feb 2006 16:53 GMT
> Can you xor Arraylist together?  by using the ^ notation. I know the ^
> is for integer representation so if i type cast it to Arraylist would
> that be sufficient?

What would be the expected output of XORing two ArrayLists?

   robert
cryptogirl - 24 Feb 2006 17:00 GMT
What would be the expected output of XORing two ArrayLists?

basically i'm implementing WEP dictionary attack for school.   And I
had to store all possible key stream in a hash table and a hash table
on take in type Object so my keystream were inputted into an Array
List.    I'm going to have my plaint text and convert it to bytes and
place that into an array list.  and then xor both together in order to
retrieve the cipher text.
Chris Uppal - 24 Feb 2006 20:03 GMT
> basically i'm implementing WEP dictionary attack for school.

If you are doing anything compute -intensive with collections of primitive
types (int, byte, etc) then you'd be /far/ better off putting the data into a
normal int[] or byte[] array.

> and then xor both together in order to
> retrieve the cipher text.

There's no built-in method of computing the elementwise XOR of two ArrayLists,
nor of doing the same with two byte[] arrays.  You'll have to code it yourself
with a loop.

   -- chris
christian.bongiorno@gmail.com - 24 Feb 2006 21:21 GMT
Actually,

Why couldn't he  do this:

BigInteger entry1 = new BigInteger(someByteArrayFromKey)
BigInteger entry2 = new BigInteger(someByteArrayFromOtherKey);

BigInteger newEntry = entry1.xor(entry2);

Jobs done and he can use keys of any size

Christian
http://christian.bongiorno.org/resume.pdf
Chris Uppal - 25 Feb 2006 16:17 GMT
> BigInteger entry1 = new BigInteger(someByteArrayFromKey)
> BigInteger entry2 = new BigInteger(someByteArrayFromOtherKey);
>
> BigInteger newEntry = entry1.xor(entry2);

That's a neat idea.

You would have to be careful about the possibility of leading[*] zeros in the
data.  You could keep track of the size of the input arrays, and ensure that
the output array is copied and shifted (if necessary) to be the same size as
the inputs.  Another idea would be to force the inputs to have 0x01 and 0x02 in
position 0, computing the real xor for that position separately, and then stuff
that into position 0 of the result.

Overall, sadly, I think it's probably easier to use a loop.

   -- chris
christian.bongiorno@gmail.com - 26 Feb 2006 23:15 GMT
Yeah, that's true. In an academic setting like his it won't matter. One
way of doing this would be to override xor() to assure the proper bit
maintenance. There is also BitSet -- but it doesn't take a convenient
byte[] input.
Roedy Green - 24 Feb 2006 20:07 GMT
>Can you xor Arraylist together?  by using the ^ notation. I know the ^
>is for integer representation so if i type cast it to Arraylist would
>that be sufficient?
see the SortedArrayList class that allows various merging operations.

See http://mindprod.com/products1.html#SORTEDARRAYLIST

this is not APL, Operators work only on primitives.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.