DES data encryption utilities.

This package contains an optimized implementation of DES (the Data Encryption Standard described in FIPS PUB 46), including several alternative DES operating modes.

bit ordering

In FIPS PUB 46, the offical government publication on DES, 64-bit blocks are used to represent plain text, cipher text, and keys. However, the government publication describes the algorithm using a bit ordering that is clumsy for software implementation. In that publication, the left-most bit is labeled as bit 1, while the right-most bit is labeled as bit 64.

In this implementation, however, the left-most bit is labeled as bit 63 and is regarded as the "most significant bit," while the right-most bit is labeled bit 0 and is regarded as the "least significant bit." This translation is easy to comprehend when longs are used to represent the blocks. However, because this implementation also allows blocks to be represented using bytes, shorts, and ints, strict ordering of the elements must be observed. Hence, all arrays of these types are regarded as big-endian.

For clarity, the mapping between the bit ordering described in FIPS PUB 46 and this implementation is illustrated below for all of the array types supported:

JCE note

When bytes are used, the bit mapping used in DesEngine is the same as the JCE's DES implementation. The only difference is that DesEngine is faster. :-)