CN102752108B - Magic cube encryption and decryption method - Google Patents

Magic cube encryption and decryption method Download PDF

Info

Publication number
CN102752108B
CN102752108B CN201210220262.XA CN201210220262A CN102752108B CN 102752108 B CN102752108 B CN 102752108B CN 201210220262 A CN201210220262 A CN 201210220262A CN 102752108 B CN102752108 B CN 102752108B
Authority
CN
China
Prior art keywords
character
magic square
transposition
section
square
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210220262.XA
Other languages
Chinese (zh)
Other versions
CN102752108A (en
Inventor
梁俊杰
周雪斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WUHAN WIND GATHER INTELLIGENCE TECHNOLOGY Co.,Ltd.
Original Assignee
Hubei University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hubei University filed Critical Hubei University
Priority to CN201210220262.XA priority Critical patent/CN102752108B/en
Publication of CN102752108A publication Critical patent/CN102752108A/en
Application granted granted Critical
Publication of CN102752108B publication Critical patent/CN102752108B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a magic cube encryption method, which belongs to the technical field of computer information security. The method is characterized in that a key is specially defined, each character in a key character string is used for expressing one rotary operation of a magic cube, and the rotary operation corresponds to a transposition rule of a series of magic cube diamond sequence numbers; one character in the key is sequentially obtained from left to right in encryption, a series of transposition is carried out on bit number values of a plaintext according to the transposition rule set by the character, exclusive or operation is performed by utilizing a letter after being circularly moved leftwards or rightwards, and finally a ciphertext is obtained. The invention also provides a decryption method based on the encryption method, and the decryption process is the invert operation of the encryption operation process. Due to the adoption of the rotation concept of the magic cube, the decryption speed is fast, the key length is not restricted, the encryption strength is large, the ciphertex highly depends on the key, so that different decipher methods such as password attack and enumeration attack can be prevented.

Description

Magic square encryption and decryption method
Technical field
The invention belongs to the field of information security technology in computer, is a kind of general data encryption/decryption method, is applied to the fields such as computer security, communication security and national defence.
Background technology
The basic process of data encryption is exactly to being that file or data are expressly processed by certain algorithm originally, becomes unreadable one section of code, is commonly referred to " ciphertext ", reaches the object that protected data is not illegally stolen, read.The inverse process of this process is deciphering, is reduced to process expressly by cipher-text information.
Encryption method is divided into two large classes conventionally: " symmetrical expression " encryption method and " asymmetric " encryption method.
Symmetric encryption method mainly contains: DES(Data Encryption Standard), data encryption standard, speed, is applicable to encrypt the occasion of mass data; RC2 and RC4, be encrypted mass data by elongated secret key, faster than DES; IDEA(International Data Encryption Algorithm) IDEA, use 128 secret keys that very strong fail safe is provided; AES(Advanced Encryption Standard): Advanced Encryption Standard is follow-on cryptographic algorithm standard, and speed is fast, and level of security is high;
Asymmet-ric encryption method mainly contains: RSA, and a kind of public keys algorithm of supporting elongated secret key, it is also variable needing the length of the blocks of files of encrypting.
Along with the develop rapidly of computer hardware technique, CPU arithmetic speed improves constantly, now traditional normal encrypt algorithm because of the length of its secret key be substantially all (<=128 position) that fix or limited, its difficulty being decrypted reduces just gradually, and this just needs to find a kind of new cryptographic algorithm to improve Cipher Strength urgently.
Summary of the invention
The present invention proposes the unrestricted and sufficiently high encryption method of Cipher Strength of a kind of secret key length, thereby solves possible that computer that the ciphertext after encrypting is exceedingly fast by performance cracks by methods such as exhaustive and cryptographic attacks.
Another object of the present invention is also to provide the decryption method based on above-mentioned encryption method.
A kind of magic square encryption method, make the one rotation operation that in secret key character string, each character representation is magic square, rotate an ex-situ operations for the corresponding a series of magic square square sequence numbers of operation, corresponding expressly this encryption method of bit location of bit stream numerical value of magic square square sequence number is specially:
(A1) plaintext is converted to binary system, and is one section by every 64 bits and is divided into some transposition sections, 64 of final stage less thaies use book character polishing;
(A2) sequentially extract single character from secret key character string one by one, respectively ex-situ operations is carried out in the corresponding bit position of each transposition section according to a series of magic square square sequence number ex-situ operations that this character is corresponding;
(A3) sequentially the ex-situ operations result of each transposition section is connected, and is one section by 6 bits and is divided into some sections, convert each section of corresponding decimal system numerical value to corresponding character according to ASCII character table, the character string of the character composition being converted to is ciphertext.
Further, described step (A2) is sequentially extracted single character X from secret key character string one by one, respectively the corresponding bit position of each transposition section is carried out after ex-situ operations according to a series of magic square square sequence number ex-situ operations that this character X is corresponding, also this ex-situ operations result is carried out to bit position ring shift left or moved to right, and ring shift left or the result that moves to right are carried out to XOR with the character string being made up of eight character X.
Magic square deciphering method based on described magic square enciphered method, is specially:
(B1) each character of ciphertext is converted to the string of binary characters of corresponding 6 bits according to ASCII character table;
(B2) each string of binary characters of sequentially step (B1) being obtained is connected, and is one section by every 64 bits and is divided into some contrary transposition sections;
(B2) sequentially extract single character from secret key character string one by one, inverse operation according to a series of magic square square sequence number ex-situ operations corresponding to this character carries out ex-situ operations to each against the corresponding bit position of transposition section respectively, this ex-situ operations result is converted to corresponding character according to ASCII character table and obtains expressly.
Further, the magic square deciphering method based on described magic square enciphered method, is specially:
(C1) each character of ciphertext is converted to the string of binary characters of corresponding 6 bits according to ASCII character table;
(C2) string of binary characters that sequentially step (C1) obtained is connected, and is one section by every 64 bits and is divided into some contrary transposition sections;
(C3) sequentially extract single character X from secret key character string one by one, each contrary transposition section is carried out to XOR with the character string being made up of eight character X respectively, and XOR result is carried out bit position ring shift right or moved to left;
(C4) carry out ex-situ operations in the corresponding bit position of the contrary transposition section to each character ring shift right or after moving to left respectively according to the inverse operation of a series of magic square square sequence number ex-situ operations corresponding to character X, this ex-situ operations result is converted to corresponding character according to ASCII character table and obtains expressly.
Magic square encryption method of the present invention has been used for reference the concept of magic-square rotary, and deciphering speed is fast, and secret key length is unrestricted, and Cipher Strength is large, and ciphertext is very high to the interdependency of secret key, can take precautions against various cryptographic attacks, enumerate the crack methods such as attack.
Brief description of the drawings
Fig. 1 is ciphering process flow chart of the present invention.
Fig. 2 is decrypting process flow chart of the present invention.
Fig. 3 is the magic square code pattern using in the present invention.
Fig. 4 is example ciphering process schematic diagram, Fig. 4 a is binary system schematic diagram expressly, Fig. 4 b is first group of transposition schematic diagram, Fig. 4 c is the result schematic diagram after first character " 1 " encryption through secret key, Fig. 4 d is bit position ring shift left result schematic diagram, and Fig. 4 e is XOR result schematic diagram, and Fig. 4 f is the result schematic diagram after last character " 5 " encryption of secret key, Fig. 4 g is for pressing byte section result figure, and Fig. 4 h is for pressing 6 bit segments schematic diagrames.
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in further detail, but this embodiment should not be construed as limitation of the present invention.
The inventive method is named as " magic square cryptographic algorithm ", in algorithm, secret key is done to special definition, secret key be with one not the character string of limit for length's degree represent, wherein each character setting is a series of ex-situ operations to plaintext bit numerical value, the concept of magic-square rotary has been used for reference in this operation, as shown in Figure 3, for the magic square of a standard, it has 6 faces, every one side has again 3 × 3 blockages, the present invention is to each blockage number of being numbered with in sequence, its numbering is just corresponding to each sequence number of one section of bit stream, in the time that magic square completes a rotating operation, there is variation in the blockage position on magic square, record the change procedure of blockage, and this process is replaced corresponding to the numerical value of 6 × 3 × 3=54 position bit stream correspondence position.
Indication magic square of the present invention not only comprises that the every one side of positive hexahedron has the magic square of 3X3 square, also comprises that every one side has the positive hexahedron magic square of 4 × 4 squares, until every face has positive hexahedron or the polyhedron magic square of n × n square, also comprises evil spirit cylinder etc.
For the object of the invention, the method that the present invention adopts is: when encryption, get from left to right successively a character in secret key, then with the rule of conversion of this character setting, bit numerical value is expressly carried out to a series of transpositions, and carry out xor operation with this letter after ring shift left, finally just obtain ciphertext.Decrypting process carries out inverse operation to aforesaid operations process exactly.
As shown in Figure 1, encryption method concrete steps of the present invention are described as follows:
Step 1: plaintext is one section by every 64 bit value and is divided into some sections, " 0 " polishing (do not limit to and adopt 0, designated character arbitrarily), the plaintext after segmentation is expressed as m for use that final stage less than is 64 1m 2m 3m n;
Step 2: suppose that secret key character string is X 1x 2x 3x t, wherein define each character and represent the one rotation operation of magic square, and be mapped as the interchanging method to 64 bit value.Step 3: first to section m 1be encrypted: the first character X that gets secret key 1, according to X 1definition to m 1carry out ex-situ operations, result is designated as r 1;
Step 4: by r 1in 2 of bit position ring shift lefts, obtain s 1;
Step 5: by s 1with by eight X 1the character string forming is carried out XOR, obtains t 1;
Step 6: get successively the character late of secret key, repeating step 3, step 4, step 5 are until take all characters of secret key, the result e finally obtaining 1, be m 1result after encryption;
Step 7: get successively next section expressly, repeated execution of steps 3, step 4, step 5, complete the expressly encryption of all segmentations.
Step 8: all e 1, e 2, e 3... e nbe merged into a character string, and be one section by every 6 bits and be divided into some sections; By each section of corresponding binary numeral, convert a character to according to coding schedule; All long character strings of character composition, are ciphertext.
The mapping relations of character and rotation operation can designed, designed, there is no condition restriction.Step 4 and step 5 are the Cipher Strengths for further strengthening magic square enciphered method, all can in ring shift left and 1 ~ 63bit position that moves to right.
Decryption method of the present invention as shown in Figure 2, is carried out inverse operation to flow process shown in Fig. 1 exactly, does not repeat them here.
Embodiment:
Expressly: abcdefgh
Secret key: 12345
1) in this example, be expressly 8 bytes (i.e. 64 bits), do not need to do segment processing.Binary system expressly represents as Fig. 4 a:
2), by question blank 2 and table 1, obtain respectively forming character " 1 ", " 2 ", " 3 ", " 4 " of secret key, the magic square rule of conversion of " 5 ".
3) from left to right get the first character " 1 " of secret key, by the magic square rule of conversion of character " 1 " to expressly replacing.
Specifically, the rule of conversion of character " 1 " is:
As shown in Figure 4 b, first group of transposition: change to the 34th for the 3rd, change to the 52nd for the 34th, change to the 12nd for the 52nd, change to the 3rd for the 12nd.
Second group of transposition: change to the 31st for the 6th, change to the 49th for the 31st, change to the 15th for the 49th, change to the 6th for the 15th.
The 3rd group of transposition: change to the 28th for the 9th, change to the 46th for the 28th, change to the 18th for the 46th, change to the 9th for the 18th.
The 4th group of transposition: change to the 21st for the 19th, change to the 27th for the 21st, change to the 25th for the 27th, change to the 19th for the 25th.
The 5th group of transposition: change to the 24th for the 20th, change to the 26th for the 24th, change to the 22nd for the 26th, change to the 20th for the 22nd.
Result r after first character " 1 " encryption of secret key 1as shown in Fig. 4 c.
4) by r 12 of ring shift lefts of entirety obtain s 1, result is as shown in Fig. 4 d.
5) by character string and the s of eight characters " 1 " composition 1xOR obtains result t 1, result is as shown in Fig. 4 e.
6) character late of getting successively secret key is " 2 ", repeats 3), 4), 5) process obtain t 2.
7) character late of getting successively secret key is " 3 ", repeats 3), 4), 5) process obtain t 3.
8) character late of getting successively secret key for " 4, repeat 3), 4), 5) process obtain t 4.
9) last character of getting secret key is " 5 ", repeats 3), 4), 5) process obtain t 5, as shown in Fig. 4 f.
10) by t 5be divided into 3 sections by one section of 3 byte, final stage only has 2 characters for byte "=" polishing, and character "=" plays the effect of end mark here, and result is as shown in Fig. 4 g:
Be that a component becomes 4 groups first paragraph by 6 bits, as shown in Fig. 4 h.
Each is organized to corresponding decimal system numerical value and add 1, taking this numerical value as position number, every group of bit value is converted to some characters in character string " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123 456789* & ", for example the binary system of 6 bits of first paragraph is 011010, its decimal system numerical value is 26, and in corresponding character string above, the character of 26+1 position is " a ".With the method, all characters after conversion are merged and obtain final ciphertext " aFDCu27k*nQ=".
This result is the result after encryption, and decrypting process is the inverse process of above process.
27 kinds of bit stream rules of conversion corresponding to operation of table 1 magic square
Magic square conversion table corresponding to part ASCII character character that table 2 magic square encryption method is used
The content not being described in detail in this specification belongs to the known prior art of professional and technical personnel in the field.
Those skilled in the art will readily understand; the foregoing is only preferred embodiment of the present invention; not in order to limit the present invention, all any amendments of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.

Claims (4)

1. a magic square encryption method, make the one rotation operation that in secret key character string, each character representation is magic square, rotate an ex-situ operations for the corresponding a series of magic square square sequence numbers of operation, the corresponding expressly bit location of bit stream numerical value of magic square square sequence number, this encryption method is specially:
(A1) plaintext is converted to binary system, and is one section by every 64 bits and is divided into some transposition sections, 64 of final stage less thaies use book character polishing;
(A2) sequentially extract single character from secret key character string one by one, respectively ex-situ operations is carried out in the corresponding bit position of each transposition section according to a series of magic square square sequence number ex-situ operations that this character is corresponding;
(A3) sequentially the ex-situ operations result of each transposition section is connected, and be one section by 6 bits and be divided into some sections, convert each section of corresponding decimal system numerical value to corresponding character according to ASCII character table, the character string of the character composition being converted to is ciphertext.
2. magic square encryption method according to claim 1, it is characterized in that, described step (A2) is sequentially extracted single character X from secret key character string one by one, respectively the corresponding bit position of each transposition section is carried out after ex-situ operations according to a series of magic square square sequence number ex-situ operations that this character X is corresponding, also this ex-situ operations result is carried out to bit position ring shift left or moved to right, and ring shift left or the result that moves to right are carried out to XOR with the character string being made up of eight character X.
3. the magic square decryption method based on magic square enciphered method claimed in claim 1, is specially:
(B1) each character of ciphertext is converted to the string of binary characters of corresponding 6 bits according to ASCII character table;
(B2) each string of binary characters of sequentially step (B1) being obtained is connected, and is one section by every 64 bits and is divided into some contrary transposition sections;
(B2) sequentially extract single character from secret key character string one by one, inverse operation according to a series of magic square square sequence number ex-situ operations corresponding to this character carries out ex-situ operations to each against the corresponding bit position of transposition section respectively, this ex-situ operations result is converted to corresponding character according to ASCII character table and obtains expressly.
4. the magic square decryption method based on magic square enciphered method claimed in claim 1, is specially:
(C1) each character of ciphertext is converted to the string of binary characters of corresponding 6 bits according to ASCII character table;
(C2) string of binary characters that sequentially step (C1) obtained is connected, and is one section by every 64 bits and is divided into some contrary transposition sections;
(C3) sequentially extract single character X from secret key character string one by one, each contrary transposition section is carried out to XOR with the character string being made up of eight character X respectively, and XOR result is carried out bit position ring shift right or moved to left;
(C4) carry out ex-situ operations in the corresponding bit position of the contrary transposition section to each character ring shift right or after moving to left respectively according to the inverse operation of a series of magic square square sequence number ex-situ operations corresponding to character X, this ex-situ operations result is converted to corresponding character according to ASCII character table and obtains expressly.
CN201210220262.XA 2012-06-29 2012-06-29 Magic cube encryption and decryption method Active CN102752108B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210220262.XA CN102752108B (en) 2012-06-29 2012-06-29 Magic cube encryption and decryption method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210220262.XA CN102752108B (en) 2012-06-29 2012-06-29 Magic cube encryption and decryption method

Publications (2)

Publication Number Publication Date
CN102752108A CN102752108A (en) 2012-10-24
CN102752108B true CN102752108B (en) 2014-12-10

Family

ID=47032021

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210220262.XA Active CN102752108B (en) 2012-06-29 2012-06-29 Magic cube encryption and decryption method

Country Status (1)

Country Link
CN (1) CN102752108B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468842A (en) * 2014-12-31 2015-03-25 国网甘肃省电力公司信息通信公司 Power grid equipment state information cloud storage system and data uploading and downloading methods thereof
US10952069B1 (en) 2017-11-07 2021-03-16 Imam Abdulrahman Bin Faisal University IoT cryptosystem device, system, method and computer program product
CN110287714A (en) * 2019-06-13 2019-09-27 杭州电子科技大学 A kind of encryption of RAID secure storage and decryption method based on virtual magic square
CN110262722A (en) * 2019-06-21 2019-09-20 深圳市趣创科技有限公司 Mobile terminal unlocking method and device
CN112422491A (en) * 2020-05-08 2021-02-26 上海幻电信息科技有限公司 Encryption and decryption method for digital codes, server and storage medium
CN112019328B (en) * 2020-10-31 2021-01-26 北京华云安信息技术有限公司 Encryption method, device, equipment and storage medium of IP address
CN116436605B (en) * 2023-06-13 2023-08-15 三未信安科技股份有限公司 Mass key management method, system and storage medium based on key magic square

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1279851A (en) * 1997-10-24 2001-01-10 沙乌尔·O·巴卡尔 Virtual matrix encryption (VME) and virtual key cryptographic method and aparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2848752A1 (en) * 2002-12-17 2004-06-18 France Telecom Information e.g. telephone number, cash card number encoding method, involves executing succession of permutations on finite series of symbols, where encoded information is constituted by series obtained from permutation

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1279851A (en) * 1997-10-24 2001-01-10 沙乌尔·O·巴卡尔 Virtual matrix encryption (VME) and virtual key cryptographic method and aparatus

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
三阶魔方旋转加密解密文件算法的设计与实现;袁开友等;《教育教学》;20100831;全文 *
袁开友等.三阶魔方旋转加密解密文件算法的设计与实现.《教育教学》.2010, *
陈涛,谢阳群.基于扩展的N维魔方加密算法的设计与实现.《情报杂志》.2005, *

Also Published As

Publication number Publication date
CN102752108A (en) 2012-10-24

Similar Documents

Publication Publication Date Title
CN102752108B (en) Magic cube encryption and decryption method
CN101013938B (en) Encryption method of block cipher
CN110299989B (en) Encryption and decryption method for Chinese and English character strings
CN101461173B (en) Method of homonymous substation symmetric encryption
CN104333446B (en) A kind of novel ultra-light magnitude QTL block cipher implementation method
CN108964872B (en) Encryption method and device based on AES
CN109245881A (en) A kind of photograph video cloud encryption storage method
CN112199696B (en) Encryption and decryption method based on white-box block cipher
CA2414261A1 (en) Method of encryption using multi-key process to create a variable-length key
CN110650005B (en) Chinese and English character string encryption method
CN101335616B (en) Symmetric ciphering method having infinite cipher key space
CN101951314A (en) Design method of S-box in symmetric password encryption
CN111314270B (en) Data encryption and decryption method based on validity period uniform distribution symmetric algorithm
CN107835070B (en) Simple embedded encryption method
Hameed et al. Modified advanced encryption standard for text and images
CN110650006B (en) Encryption and decryption method for Chinese and English character strings
Soe et al. Performance analysis of data encryption standard (DES)
Goyal et al. Implementation of Modified Playfair CBC Algorithm
CN105553644A (en) 32-bit-packet length lightweight encryption and decryption method
CN111314053B (en) Data encryption and decryption method
CN111314052A (en) Data encryption and decryption method based on uniformly distributed symmetric compression algorithm
Wang et al. Attack to an image encryption based on chaotic Logistic map
CN112235098B (en) Simple and rapid communication encryption and decryption method
CN101093627B (en) Device for encoding and decoding cipher
CN115622745A (en) Encryption method, device, terminal equipment and computer readable storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
ASS Succession or assignment of patent right

Owner name: ZHOU XUEBIN

Effective date: 20130701

C41 Transfer of patent application or patent right or utility model
TA01 Transfer of patent application right

Effective date of registration: 20130701

Address after: 430062 Wuhan, Hubei Friendship Road, No. 368, Wuchang

Applicant after: Hubei University

Applicant after: Zhou Xuebin

Address before: 430062 Wuhan, Hubei Friendship Road, No. 368, Wuchang

Applicant before: Hubei University

C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210830

Address after: 8 / F, Jiuwanli talent base, 122-88 Zhongbei Road, Wuchang District, Wuhan City, Hubei Province, 430000

Patentee after: WUHAN WIND GATHER INTELLIGENCE TECHNOLOGY Co.,Ltd.

Address before: 430062 368 Friendship Avenue, Wuchang District, Wuhan, Hubei.

Patentee before: Hubei University

Patentee before: Zhou Xuebin