The DES (Data Encryption Standard) takes 64 bit key as input but how is the plain text of length say n is getting converted into 64 bit binary format?

  • 3
    $\begingroup$ Depends on the mode of operation $\endgroup$ – fgrieu Sep 30 '16 at 15:54
  • 2
    $\begingroup$ Related question: when you talk on the phone to someone, are you supposed to speak English, Spanish or Mandarin? Answer: as long as whoever you're calling understands it, it doesn't matter - the phone doesn't care... $\endgroup$ – poncho Sep 30 '16 at 16:52
  • $\begingroup$ If you have e.g. a nomal English text, you can in a program first have it transformed into a byte sequence according to UTF-8 and then let each successive 8 bytes as a block be input into your DES routine for encryption processing. For UTF-8, see Wiki. The transformation from a text string to a byte sequence can be done e.g. in Python with the system functon bytearray() as follows: bytesequence=bytearray(textstring, coding="UTF-8"). $\endgroup$ – Mok-Kong Shen Oct 1 '16 at 11:06

The conversion to binary is not part of the DES standard. So you'll have to define that part of the protocol yourself. The cipher itself needs to be used with a mode of operation, as fgrieu indicated.

There are basically two families of modes of operation: streaming modes of operation and block modes of operation.

In block modes sych as ECB or CBC you have to split the plaintext into separate, sequential blocks, usually after padding the plaintext.

In streaming modes such as CFB and OFB the bytes may be encrypted byte for byte.

Of course the API (the programming interface) of high end implementations of ciphers or modes may hide such implementation details.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.