>I'm trying to implement the DES encryption in Java. I have a couple of
>concerns at the moment. The first is if I am importing a text file
>how do i implement this in a binary or hexidecimal format. I've looked
>through the api specifications but am not sure how to go about
>it.
try asking in comp.lang.java.security.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
> Hi,
>
[quoted text clipped - 3 lines]
> through the api specifications but am not sure how to go about
> it.
Your question doesn't make sense as it is formulated. All you have in
your computer is bits. Text files consist of bits, just like executable
files consist of bits. DES works on 64 bit chunks of data, or 8 bytes.
Just treat everyhing as bytes and you'll be ok.
> Secondly, I'm thinking of using the bigInteger class in order to implement
> left shifts towards the end of the algorithm. Is this viable, as it
> has a left shift method already included .. or is there a simpler way . .??
The shift operators work on the built in types (namely int and long).
<< left shift
>> right shift
>>> unsigned right shift
and same as assignment
<<=
>>=
>>>=
There is no point in using BigInteger. It will be very slow. You can get
along with normal ints since IIRC, most of the operations are done on
halves of the 64 bit key.

Signature
Daniel Sjöblom
Remove _NOSPAM to reply by mail