# TEDL: A Text Encryption Method Based on Deep Learning
## 1 Introduction  
Today, more and more important data are transmitted in text format, whose security is guaranteed by various encryption methods. They include classic encryption algorithms (e.g., 3 DES, AES, RSA) that have been widely used, as well as some innovative encryption algorithms (e.g., DNA algorithm [1, 2], chaotic map algorithm [3]). Especially, AES, a representative of symmetric encryption, is rather popular and accepted as data encryption standard [4], due to its high speed and low space performance. Besides, another symmetric-key algorithm called one-time pad (OTP) [5, 6] proves to be unbreakable. However, some defects still exist. Firstly, the strength of most symmetric-key algorithms relies on the key size [7, 8]. It means that the security degrades proportionally as the key space gets smaller. One solution is to increase the complexity of the encryption algorithm. Then for the same size of key space, attackers need more time to crack. However, it sacrifices efficiency, namely, both communication parties need to spend more time on encryption and decryption. It is a challenge to achieve a balance between security and efficiency. Moreover, for OTP, when a large amount of information needs to be transmitted, it suffers from the difficulty in key updating. The problem of secure key distribution makes it impractical for most applications [9]. Therefore, cryptologists are constantly designing more practical encryption methods to get close to OTP. The stream cipher is one of the alternatives, while it is vulnerable if used incorrectly [10]. Deep learning [11] has become a hot field in artificial intelligence. By training, the learning model can automatically learn the mapping from massive data to the labels. Thisprocess is controlled by some hyperparameters and generates a large number of unexplained parameters. Sometimes these parameters act as abstract representations of input data, although they do not seem to have any clear relations. When those hyperparameters are unknown or changed, or when the labels are altered, the exact parameters cannot be obtained. Therefore, a deep learning model embodies the nature of encryption. In other words, replacing meaningful data with corresponding parameters can be regarded as an encryption process [12]. A typical case is word embedding based on deep learning model [13; 14], the cornerstone of Natural Language Processing (NLP). The most classic one is the _Word2 vec_[15; 16], which is improved by _Glove_[17], _fastText_[18], and so on. These models map words into distributed representations, which consist of parameters. Once we change the hyperparameters or corpus, the word representations (parameters) will change. In addition, deep learning training usually takes a long time, and the adjustment of each hyperparameter means a lot of time lapse. To some extent, this feature is useful to enhance security. In this paper, we introduce the above characteristics of deep learning into text encryption and propose a novel symmetric encryption method for text encryption named TEDL. It adopts a public corpus as the original corpus, two copies of which are owned by both communication parties. They modify the copy at hand to obtain a synthetic corpus under the guidance of the key, respectively. The synthetic corpus owned by both should be confidential and consistent. After that, same word embedding models are used to train on the synthetic corpus under the hyperparameters specified by the key and construct word vector tables. Combined with the SHA-256 function [19], they are further processed to obtain time-varying codebooks, which is definitely consistent as well. The sender replaces the plaintext with a ciphertext based on the codebook and transmits it to the receiver. The receiver decrypts the ciphertext according to the codebook in turn.