IBM's Mars Encryption algorithm implementation (next)

Source: Internet
Author: User
Tags bitwise rounds

2.3 Ciphertext decryption

The generation of the 40 sub keys used for ciphertext decryption is the same as the generation method for the 40 subkeys in plaintext encryption.

2.3.1 First step forward mixing

The input 128-bit ciphertext is divided into four d[0],d[1],d[2],d[3], and the last four of the 40 keys generated are selected to be added to the four pieces of data respectively.

D[0] + = k[36];

D[1] + = k[37];

D[2] + = k[38];

D[3] + = k[39];

Results as input data for the first-round operation.

First round:

D[0] D[1] D[2] D[3]
B0 B1 B2 B3 Firsttarget Secondtarget Thirdtarget

Combine d[0],d[1],d[2],d[3] into 128-bit data, loop left 32 bits into four blocks d[0],d[1],d[2],d[3] where d[0] as source data, the remaining 3 as the target data, the D[0 Loop right 24-bit results back to d[0]

32-bit source data d[0] into 8-bit four B0,B1,B2,B3

B0 B1 B2 B3 Firsttarget Secondtarget Thirdtarget
Before moving D[0] D[1] D[2] D[3]
After moving D[1] D[2] D[3] D[0]

B0 and B2 as array subscripts look for S-box replacements from S1: S1[b0],s1[b2]

B1 and B3 as array subscripts look for S-box replacements from S0: S0[b1],s0[b3]

Actions on Firsttarget:

Firsttarget the result of a bitwise XOR or S1[B0] return to Firsttarget

Actions on Secondtarget:

Secondtarget plus S0[B3] Returns the result to Secondtarget

Actions on Thirdtarget:

Thirdtarget is returned to thirdtarget with the result of a bitwise XOR or S0[B1] plus s1[b2].

This step is carried out in a total of 8 rounds, Add the action at the end of the first and fifth rounds to return the result of source plus firsttarget to source. Add the action at the end of the second and sixth rounds to return the result of source plus thirdtarget to source

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.