Using data pack for DES-like encryption and decryption
This article introduces a method of using data in Minecraft data packs to simulate the DES encryption and decryption algorithm. In view of the limitation in the number of instructions of the 16-round Feistel network of the original DES algorithm, this plan simplifies it to 2 rounds of iterations, removes the compressed transposition operation, uniformly adopts the key scheduling strategy of shifting one bit to the left, and changes the round functi. The special case of onF is the XOR operation between the right half and the subkey. In order to adapt to the in-game data storage format, an encoding scheme containing 64 characters (numbers, upper and lower case letters, spaces and newlines) is designed. The characters are mapped into 6-bit binary through base64, and execute is used. The return value feature of the store success instruction cleverly implements the XOR operation. The decryption process takes full advantage of the reversibility of the Feistel network and can restore the plaintext only by using the subkey in reverse order. In addition, this article also implements functions such as random key generation, custom key input, and variable length keys, and provides a corresponding UI interface. Although the encryption strength of this project is limited, it shows the feasibility and creativity of implementing cryptographic algorithms in a restricted environment.


