A File Encryption Algorithm Based On Dynamic Block Out of Order Matrix Mapping
A File Encryption Algorithm Based On Dynamic Block Out of Order Matrix Mapping
Abstract—In order to solve the security of content transfer divided into the same proportion of blocks for data
during file transfer and fast encryption of large files. This paper replacement. The extracted raw data, indexes and weights of
proposes a method to quickly encrypt large files and protect the relevant data are calculated according to certain rules to form
contents of file information, also prevent files from being a block of data to be mapped into the matrix in disorder. And
intercepted and decrypted before use. The algorithm of file then conduct the Base64 coding to the disordered matrix data
encryption based on dynamic block out of order matrix so that the matrix is equivalent to the unique decryption key
mapping. First, dynamically block the files according to a of the file.
certain ratio, extract the raw data and key information of each
block, then store the out of order data into a two-dimensional II. CONSTRUCT ENCRYPTION ALGORITHM
table of matrix after calculation and processing. Second, use
Base64 encoding on this matrix mapping table. Then the matrix A. Dynamic Block with random position of File
mapping table is to be a unique decryption key of this file. After The file to calculate the number of blocks by use file
that, the data in the spare block of the file is filled with the MD5 length(Byte) mod 1024 3 powers, Then multiply by 8. It can
data, the MD5 data is generated by UUID and block with the be calculated by the following formula:
same size as the number of dynamic block. The new encrypted
file whose length is equal to the original file. Because it is
dynamic block and random extracted data, so it is fast and
8 L < 10243
Β= (1)
( L 1024 ) × 8
efficient. The experimental results and security analysis show 3
that the algorithm has a good encryption structure and high
L ≥ 10243
security, which can effectively resist various attack behaviors.
Most of the files that with different types can be used, and the Where L is the length of the file (Byte) and B is the
speed to encrypt and decrypt large files is greatly improved calculated number of blocks.
compared with the traditional encryption and decryption
After determining the number of blocks, and then
methods, the speed and efficiency far exceed the traditional file
randomly determine the range of extracted data positions of
encryption and decryption algorithms, such as AES, DES,
3DES and so on. each block. Specifying that the file header and the file tail are
fixed extracted data blocks [4], the other B-2 blocks
Keywords—Dynamic block, Large file, Encryption, Out of determine the position by generating random numbers. And
order Matrix, Mapping the size of each block is 4 bytes, so the random number range
is (4, L-4).
I. INTRODUCTION
The formula for generating random numbers is the Linear
At present, the encryption methods of common files Congruence Method [5]:
mainly adopt symmetric encryption algorithms, such as AES
, DES, 3DES and so on [1]. Symmetric encryption is fast, = + , ≥ 0. (2)
simple, with small calculation, and uses the same key for Among them,
encryption and decryption. This method has obvious
, ℎ ; 0< .
advantages in encrypting small files or text messages, but for
, ℎ ; 0≤ < .
the medium-sized or large files the process of encryption is
slow and inefficient. In addition, both the encrypting side and , ℎ ; 0≤ < .
the decrypting side of the file need to share and use the same , ℎ ;0 ≤ < .
key [2]. If there is leakage for any side, then the encrypted The structure resulting from the final block is roughly as
information is not safe any more, which is not safe for both follows:
side. And also there is a problem with the uniqueness of this 0 1 2 …… B-1 B
key, which may be duplicated [3].
Fig. 1. The Structure of Blocks
Therefore, in order to solve the above problems, this paper
proposes a file encryption algorithm based on dynamic block B. Generate replacement data blocks
out of order matrix mapping: dynamically block files
according to a certain random ratio, extract 4 bits of raw data Then generate a UUID and remove the - separator [6] in
between each blocks. The MD5 value generated by UUID is the UUID. MD5 is performed on the UUID, and the 32-bit
string of the UUID is divided into blocks, also the 32-bit string
of the obtained MD5 is also divided into blocks [7]. The Calculate the Randomly determine
Raw File number of blocks
UUID block data after is used as the weight value of each data the block position
in the matrix, and the data of the MD5 block is converted to
the Byte to replace the raw data. Each block is 4 bytes in size.
C. Construct an out of order encryption matrix
First, the raw data of each block execute to add Calculate data, random Block MD5 generated by
keyWeight, displacement and so on, to get a meaningful stored in matrix UUID to replaced raw data
encryption data. Here is the following calculation method is
used for encryption to generate encrypted data:
[block+index+100][blockIndex+index+100][data+index
+100][start+keyWeight][keyWeight+10000000] Matrix converted to string, Generate Base64 key
then encoded by Base64 and encrypted file
In this format:
131 127 218 163008429 15131510
16300842 Fig. 3. Encryption process
131 127 218 15131510
9
The flow chart of decryption is as follows:
block blockInde
data+inde keyWeight
+ x start+
x +
index +index keyWeight
+100 10000000 Key Base64 Recover
+100 +100
decode matrix
Fig. 2. Data calculated format
232231
18401
209507
17473
Algorithm takes time
104650
(milliseconds)
(milliseconds)
8607
8581
90939
57529
41861
4100
2735
595
425
24
27
DBS AES DES 3DES DBS AES DES 3DES
cryptography.
DBS AES DES 3DES
REFERENCES
Fig. 6. 1187MB file encryption and decryption time consuming statistical
comparison
[1] Panda M, Nag A. Plain Text Encryption Using AES, DES and
SALSA20 by Java Based Bouncy Castle API on Windows and
The 2385MB file is dynamically divided into 2×8 random Linux[C]//Advances in Computing and Communication Engineering
blocks by the formula (1). The random 2 × 8 positions (ICACCE), 2015 Second International Conference on. IEEE, 2015:
obtained in the experiment are: 0, 713463986, 1418909879, 541-548.
1951280390, 1965044600, 2096603066, 2499832095, [2] Singh G, Kinger S. Integrating AES, DES, and 3-DES encryption
2443940873, 2289790361, 2237453225, 2171881527, algorithms for enhanced data security[J]. International Journal of
2157515025, 2122325312, 2151005447, 2145410690, Scientific & Engineering Research, 2013, 4(7): 2058.
2505806394. The generated matrix size is 16×4 size, the [3] Sivakumar R, Balakumar B, Pandeeswaran V A. A Study of
Encryption Algorithms (DES, 3DES and AES) for Information
generated key length is 2412 Byte. The encryption takes 425 Security[J]. 2018.
milliseconds, and the decryption takes 27 milliseconds.
[4] Li Xiaodong, Zhou Cailan, Huang Linquan. A SECURE AND
The figure same uses DBS to represent the algorithm of EFFICIENT IMAGE ENCRYPTION ALGORITHM BASED ON
DNA CODING[J]. Computer Application and Softwre, 2018, 35(1):
this paper. The time consuming comparison statistics of the 318-324.
2385MB file is as follows: [5] Cicirello V A. Impact of Random Number Generation on Parallel
Genetic Algorithms[C]//Proceedings of the Thirty-First International
Florida Artificial Intelligence Research Society Conference. 2018: 2-
7.
[6] Balkić Z, Šoštarić D, Horvat G. GeoHash and UUID identifier for
multi-agent systems[C]//KES International Symposium on Agent and
Multi-Agent Systems: Technologies and Applications. Springer,
Berlin, Heidelberg, 2012: 290-298.
[7] Binti Suhaili S, Watanabe T. High-Throughput Message Digest (MD5)
Design and Simulation-Based Power Estimation Using Unfolding
Transformation[J]. Journal of Signal Processing, 2017, 21(6): 233-
238.
[8] Chai X, Chen Y, Broyde L. A novel chaos-based image encryption
algorithm using DNA sequence operations[J]. Optics and Lasers in
engineering, 2017, 88: 197-213.