Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to do a very simple thing, namely using a 64-bit password and a 64-bit plaintext (both in hex) and encrypt it with simple old DES.

my script looks like this:

plaintext=`echo -n "$2" | sed 's/\(..\)/\\\x\1/g'`
printf "$plaintext" | openssl enc -nosalt -e -des -nopad -K "$key" -iv "0000000000000000" | od --format=x1 --width=32 --address-radix=n | sed 's/ //g'

I execute and get the following result:

./des_enc 5B5A57676A56676E 675A69675E5A6B5A

The problem is there's too much data coming back from openssl, I expect to only get 64-bits of data instead I get 512. I don't know how to explicit request a 64-bit version of DES, is it even possible?

Note: The values used above are from "H. Katzan, The Standard Data Encryption Algorithm, pp75-94, Petrocelli Books Inc., New York, 1977" is:

Key:        5B5A57676A56676E
Plaintext:  675A69675E5A6B5A
Ciphertext: 974AFFBF86022D1F
share|improve this question
DES is 56-bit, not 64-bit. – grawity Sep 12 '11 at 7:31

The plaintext is given in hexadecimal too. You must convert it back to binary before encrypting.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .