A ciphertext determination method, system and device based on transfer matrix

By constructing the transfer matrix and calculating the density coefficient, the problem of low ciphertext character recognition efficiency in the prior art is solved, and efficient ciphertext judgment is achieved, which is suitable for large-scale detection scenarios.

CN113806782BActive Publication Date: 2024-12-13中孚安全技术有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111155227.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-29
Publication Date
2024-12-13
Estimated Expiration
2041-09-29

AI Technical Summary

Technical Problem

The existing string recognition algorithm has high computational complexity and low execution efficiency in ciphertext character recognition. It cannot effectively extract the probability characteristics of character type conversion, and cannot meet the business needs of ciphertext character recognition.

Method used

By constructing a transfer matrix, counting the number of non-0 elements and calculating the transfer density coefficient, determining whether the character string to be judged is ciphertext, and using the transfer matrix to extract the features of the string to be quantified to quantify the readable information probability it contains.

Benefits of technology

It improves the efficiency of ciphertext character recognition, simplifies steps, reduces the computational complexity, and realizes efficient ciphertext judgment, which is suitable for large-scale detection scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113806782B_ABST
    Figure CN113806782B_ABST
Patent Text Reader

Abstract

The present invention proposes a ciphertext determination method, system and device based on a transfer matrix, the method comprising: reading a character string to be determined; constructing a transfer matrix for the character string to be determined; counting the number of non-zero elements X in the transfer matrix, if X < 3, the character string to be determined is plain text; if X ≥ 8, the character string to be determined is ciphertext; if 3 ≤ X < 8, using a preset algorithm to calculate the transfer density coefficient S of the transfer matrix; if S < 0.86, the character string to be determined is plain text; if S ≥ 0.86, the character string to be determined is ciphertext; outputting and displaying the determination result of the character string. The present invention can extract the characteristics of the character string with the help of the transfer matrix, quantify the probability that the character string contains readable information, thereby meeting the business needs of ciphertext character recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of character recognition, and more particularly to a ciphertext determination method, system and device based on a transfer matrix. Background Art

[0002] With the advent of the information age, people have gradually paid more attention to information security issues, so various encryption algorithms have been developed to encrypt information. The basic process of data encryption is to change the original information data through a special algorithm to make it an unreadable code text. This unreadable code text is called cipher text.

[0003] At present, the commonly used encryption methods in the world include DES, TDES, AES, Blowfish, CAST5, SM4, RC2, IDEA, SEED, etc. Most of them use Feistel's network structure system to perform operations such as substitution and shifting of information, and finally output a string with high information entropy. With the widespread use of ciphertext, customers often need to screen and identify ciphertext fields in strings when processing various types of information.

[0004] However, existing string recognition algorithms usually use a character-by-character recognition and judgment method, which cannot fully extract the probabilistic features of character type conversion. In addition, they have the defects of high computational complexity and low execution efficiency, and cannot meet the business needs of ciphertext character recognition. Summary of the invention

[0005] In view of the problems existing in the prior art, the purpose of the present invention is to provide a ciphertext determination method, system and device based on a transfer matrix, which can extract the characteristics of a string with the help of a transfer matrix and quantify the probability that the string contains readable information, thereby meeting the business needs of ciphertext character recognition.

[0006] In order to achieve the above object, the present invention is implemented through the following technical solutions:

[0007] A ciphertext determination method based on a transfer matrix, comprising:

[0008] Read the string to be judged;

[0009] Construct a transition matrix for the string to be determined;

[0010] Count the number of non-zero elements X in the transfer matrix. If X < 3, the string to be determined is plaintext; if X ≥ 8, the string to be determined is ciphertext.

[0011] If 3≤X<8, the transfer density coefficient S of the transfer matrix is ​​calculated using a preset algorithm;

[0012] If S < 0.86, the string to be determined is plain text; if S ≥ 0.86, the string to be determined is cipher text; the determination result of the string is output and displayed.

[0013] Further, constructing a transfer matrix for the character string to be determined includes:

[0014] If the length of the string to be determined is d, construct the transfer matrix A. The elements in the transfer matrix A can be expressed as A i,j , A i,j The initial value of is 0, where i is the row number and j is the column number;

[0015] Let row labels be: uppercase letters, lowercase letters, numbers, and special symbols; let column labels be: uppercase letters, lowercase letters, numbers, and special symbols;

[0016] Determine the value of each element in the transfer matrix A according to the types of adjacent characters in the character string to be determined;

[0017] Among them, A 1,1 is the number of consecutive characters that are all uppercase letters, A 1,2 is the number of uppercase and lowercase letters of adjacent characters, A 1,3 is the number of adjacent characters that are uppercase letters and numbers, A 1,4 is the number of adjacent characters that are uppercase letters and special symbols, A 2,1 is the number of lowercase and uppercase letters of adjacent characters, A 2,2 is the number of adjacent characters that are all lowercase letters, A 2,3 is the number of adjacent lowercase letters and numbers, A 2,4 is the number of adjacent lowercase letters and special symbols, A 3,1 The number of adjacent characters that are numbers or uppercase letters. 3,2 is the number of adjacent characters that are numbers or lowercase letters, A 3,3 is the number of adjacent characters that are all digits, A 3,4 is the number of adjacent characters that are numbers or special symbols, A 4,1 The number of adjacent characters that are special symbols or uppercase letters, A 4,2 is the number of adjacent characters that are special symbols or lowercase letters, A 4,3 is the number of adjacent characters that are special symbols or numbers, A 4,4 is the number of adjacent characters that are all special symbols.

[0018] Further, the method of calculating the transfer density coefficient S of the transfer matrix using a preset algorithm comprises the following steps:

[0019] S31: Calculate the conversion frequency of the character type according to the constructed transfer matrix A;

[0020] S32: Calculate the non-conversion frequency of the character type according to the constructed transfer matrix A;

[0021] S33: Calculate the transfer density coefficient S of the transfer matrix according to the conversion frequency of the character type and the non-conversion frequency of the character type.

[0022] Further, the step S31 includes:

[0023] The conversion frequency P of the character type is calculated by the following formula swich :

[0024]

[0025] Further, the step S32 includes:

[0026] According to the diagonal elements of the transfer matrix A, the number of adjacent characters with the same category is represented. The character type non-conversion frequency P is calculated by the following formula: retain :

[0027]

[0028] Further, the step S33 includes:

[0029] The transfer matrix transfer density coefficient S is calculated by the following formula:

[0030]

[0031] Correspondingly, the present invention also discloses a ciphertext determination system based on a transfer matrix, comprising:

[0032] A reading module, used for reading the character string to be determined;

[0033] A matrix construction module, used to construct a transfer matrix for the string to be determined;

[0034] A statistical module is used to count the number of non-zero elements X in the transfer matrix. If X < 3, the string to be determined is plain text; if X ≥ 8, the string to be determined is cipher text; if 3 ≤ X < 8, the transfer matrix is ​​sent to the calculation module;

[0035] A calculation module, used for calculating a transfer density coefficient S of a transfer matrix using a preset algorithm;

[0036] A judgment module, used for judging whether the character string to be judged is ciphertext or plaintext according to the transfer density coefficient S;

[0037] The output module is used to output and display the judgment results of the character string.

[0038] Correspondingly, the present invention also discloses a ciphertext determination device based on a transfer matrix, comprising:

[0039] Memory for storing computer programs;

[0040] A processor is used to implement the steps of the ciphertext determination method based on the transfer matrix as described in any one of the above items when executing the computer program.

[0041] Compared with the prior art, the beneficial effect of the present invention is that the present invention provides a ciphertext determination method, system and device based on a transfer matrix, which can effectively improve the determination efficiency in scenarios where a large number of ciphertexts need to be determined. Specifically, the type transfer matrix is ​​first constructed by counting the character type features in the string. This construction process is equivalent to the feature engineering process and retains the complete conversion information. Then, based on the characteristics of the string type transfer, the probability and transfer density coefficient of the specific conversion type are output. The ciphertext determination of the string is realized based on the conversion information and the transfer density coefficient.

[0042] The present invention is simple and easy to use, has clear steps and high reuse rate. The present invention can completely extract the probability characteristics of character type conversion through the characteristics of the transfer matrix. The present invention has low computational complexity and high execution efficiency. It can be applied to the scene of large-scale detection and determination of ciphertext. Ciphertext probability detection based on the transfer matrix can help enterprises, governments, security organizations or individuals to quickly screen ciphertext fields. The present invention can not only meet the basic requirements of ciphertext determination, but also help analysts to further comprehensively count and analyze the characteristics of ciphertext.

[0043] It can be seen that compared with the prior art, the present invention has outstanding substantive features and significant progress, and the beneficial effects of its implementation are also obvious. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0045] Attached Figure 1 It is a method flow chart of a specific implementation mode of the present invention.

[0046] Attached Figure 2 It is a system structure diagram of a specific implementation mode of the present invention. DETAILED DESCRIPTION

[0047] The specific implementation of the present invention is described below with reference to the accompanying drawings.

[0048] like Figure 1A ciphertext determination method based on a transfer matrix is ​​shown, comprising:

[0049] Read the string to be judged.

[0050] Construct a transition matrix for the string to be determined.

[0051] The number of non-zero elements X in the transfer matrix is ​​counted. If X < 3, the string to be determined is plaintext; if X ≥ 8, the string to be determined is ciphertext.

[0052] If 3≤X<8, the transfer density coefficient S of the transfer matrix is ​​calculated using a preset algorithm.

[0053] If S < 0.86, the string to be determined is plaintext; if S ≥ 0.86, the string to be determined is ciphertext.

[0054] Output and display the judgment result of the character string.

[0055] This method is mainly divided into two parts: string transfer matrix and extraction and calculation of transfer density coefficient.

[0056] Among them, constructing a transfer matrix for the character string to be determined includes:

[0057] If the length of the string to be determined is d, construct the transfer matrix A. The elements in the transfer matrix A can be expressed as A i,j , A i,j The initial value of is 0, where i is the row number and j is the column number; let the row labels be: uppercase letters, lowercase letters, numbers and special symbols; let the column labels be: uppercase letters, lowercase letters, numbers and special symbols. The details are shown in the following table:

[0058] uppercase letter Lowercase letters number Special symbols uppercase letter Lowercase letters number Special symbols

[0059] Transfer matrix A schematic table

[0060] According to the above table, the construction process is explained as follows: starting from the first bit of the string, check the character type of the first bit and the character type of the second bit. If the first bit type is an uppercase letter and the second bit is also an uppercase letter, the corresponding matrix A 1,1 element +1; if the first character type is an uppercase letter and the second character type is a lowercase letter, matrix A 1,2 +1; ... and so on.

[0061] When used, the value of each element in the transfer matrix A is determined according to the type of adjacent characters in the string to be determined; wherein A 1,1 is the number of consecutive characters that are all uppercase letters, A 1,2 is the number of uppercase and lowercase letters of adjacent characters, A 1,3is the number of adjacent characters that are uppercase letters and numbers, A 1,4 is the number of adjacent characters that are uppercase letters and special symbols, A 2,1 is the number of lowercase and uppercase letters of adjacent characters, A 2,2 is the number of adjacent characters that are all lowercase letters, A 2,3 is the number of adjacent lowercase letters and numbers, A 2,4 is the number of adjacent lowercase letters and special symbols, A 3,1 The number of adjacent characters that are numbers or uppercase letters. 3,2 is the number of adjacent characters that are numbers or lowercase letters, A 3,3 is the number of adjacent characters that are all digits, A 3,4 is the number of adjacent characters that are numbers or special symbols, A 4,1 The number of adjacent characters that are special symbols or uppercase letters, A 4,2 is the number of adjacent characters that are special symbols or lowercase letters, A 4,3 is the number of adjacent characters that are special symbols or numbers, A 4,4 is the number of adjacent characters that are all special symbols.

[0062] In addition, the process of calculating the transfer density coefficient of the transfer matrix using the preset algorithm is as follows:

[0063] 1. Calculate the conversion frequency of character types based on the constructed transfer matrix A.

[0064] The conversion frequency P of the character type is calculated by the following formula swich :

[0065]

[0066] 2. Calculate the non-conversion frequency of character types based on the constructed transfer matrix A.

[0067] According to the diagonal elements of the transfer matrix A, the number of adjacent characters with the same category is represented. The character type non-conversion frequency P is calculated by the following formula: retain :

[0068]

[0069] 3. Calculate the transfer density coefficient S of the transfer matrix based on the conversion frequency of the character type and the non-conversion frequency of the character type.

[0070] The transfer matrix transfer density coefficient S is calculated by the following formula:

[0071]

[0072] Through the above method, we can know that the following situations can be preliminarily judged through the transfer matrix:

[0073] (1) The string consists of a single type of characters, such as a string consisting of uppercase letters (QWERT), a string consisting of lowercase letters (effect), a string consisting of numbers (19980303), and a string consisting only of special symbols (@#¥%……&*). After encryption verification, the probability of such a string appearing is extremely small (less than one in ten thousand), and it can be directly determined to be plain text.

[0074] (2) Usually, the length of a string after encryption is greater than or equal to the length before encryption. In most cases, the length is greater. Here, it is defined that strings with a length less than 8 are all plain text.

[0075] (3) If the off-diagonal elements of the matrix are much larger than the diagonal elements, it means that the frequency of character type conversion in the string is extremely high, or the degree of confusion is high. Objectively, it is no longer readable as plaintext, so it can be directly judged as ciphertext.

[0076] In addition to the above cases, it is necessary to calculate the transfer density coefficient of the transfer matrix to make the final judgment on whether the string corresponding to the transfer matrix is ​​ciphertext. Since the transfer density coefficient can represent the degree of character type conversion of any string, after verification by a large amount of encrypted data, when the transfer density coefficient S<0.86 (empirical value), the string is considered to be plaintext, and when it is>=0.86, the string is considered to be ciphertext. The probability density coefficient has a stronger discrimination than the transfer probability, and is not affected by the length of the string. It can be universal for strings of any length and type.

[0077] Correspondingly, such as Figure 2 As shown, the present invention also discloses a ciphertext determination system based on a transfer matrix, comprising:

[0078] The reading module is used to read the character string to be judged.

[0079] The matrix construction module is used to construct a transfer matrix for the string to be determined.

[0080] The statistical module is used to count the number of non-zero elements X in the transfer matrix. If X<3, the string to be determined is plaintext; if X≥8, the string to be determined is ciphertext; if 3≤X<8, the transfer matrix is ​​sent to the calculation module.

[0081] The calculation module is used to calculate the transfer density coefficient S of the transfer matrix using a preset algorithm.

[0082] The judgment module is used to judge whether the character string to be judged is ciphertext or plaintext according to the transfer density coefficient S.

[0083] The output module is used to output and display the judgment results of the character string.

[0084] Correspondingly, the present invention also discloses a ciphertext determination device based on a transfer matrix, comprising:

[0085] Memory for storing computer programs;

[0086] A processor is used to implement the steps of the ciphertext determination method based on the transfer matrix as described in any one of the above items when executing the computer program.

[0087] Those skilled in the art can clearly understand that the technology in the embodiment of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution in the embodiment of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium such as a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, etc. Various media that can store program codes include several instructions to enable a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The same and similar parts between the various embodiments in this specification can be referred to each other. In particular, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.

[0088] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0089] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0090] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit.

[0091] Similarly, each processing unit in each embodiment of the present invention may be integrated into one functional module, or each processing unit may exist physically, or two or more processing units may be integrated into one functional module.

[0092] The present invention will be further described with reference to the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention. In addition, it should be understood that after reading the content taught by the present invention, those skilled in the art may make various changes or modifications to the present invention, and these equivalent forms also fall within the scope limited by the application.

Claims

1. A ciphertext determination method based on transfer matrix, characterized in that: include: Read the string to be judged; Construct a transition matrix for the string to be determined; Count the number of non-zero elements X in the transfer matrix. If X < 3, the string to be determined is plain text. If X ≥ 8, the string to be determined is a ciphertext; If 3≤X<8, the transfer density coefficient S of the transfer matrix is ​​calculated using a preset algorithm; If S < 0.86, the string to be determined is plain text; If S ≥ 0.86, the string to be determined is ciphertext; Output and display the judgment result of the string; The step of constructing a transfer matrix for the character string to be determined includes: If the length of the string to be determined is d, construct the transfer matrix A, and the elements in the transfer matrix A are represented by A i,j , A i,j The initial value of is 0; i is the row number and j is the column number; Let row labels be: uppercase letters, lowercase letters, numbers, and special symbols; let column labels be: uppercase letters, lowercase letters, numbers, and special symbols; Determine the value of each element in the transfer matrix A according to the types of adjacent characters in the character string to be determined; Among them, A 1,1 A is the number of consecutive characters that are all uppercase letters. 1,2 is the number of uppercase and lowercase letters of adjacent characters, A 1,3 is the number of adjacent characters that are uppercase letters and numbers, A 1,4 is the number of adjacent characters that are uppercase letters and special symbols, A 2,1 is the number of lowercase and uppercase letters of adjacent characters, A 2,2 is the number of adjacent characters that are all lowercase letters, A 2,3 is the number of adjacent lowercase letters and numbers, A 2,4 is the number of adjacent lowercase letters and special symbols, A 3,1 The number of adjacent characters that are numbers or uppercase letters. 3,2 is the number of adjacent characters that are numbers or lowercase letters, A 3,3 is the number of adjacent characters that are all digits, A 3,4 is the number of adjacent characters that are numbers or special symbols, A 4,1 The number of adjacent characters that are special symbols or uppercase letters, A 4,2 is the number of adjacent characters that are special symbols or lowercase letters, A 4,3 is the number of adjacent characters that are special symbols or numbers, A 4,4 is the number of adjacent characters that are all special symbols; The method of calculating the transfer density coefficient S of the transfer matrix using a preset algorithm comprises the following steps: S31: Calculate the conversion frequency of the character type according to the constructed transfer matrix A; S32: Calculate the non-conversion frequency of the character type according to the constructed transfer matrix A; S33: Calculating a transfer density coefficient S of a transfer matrix according to a conversion frequency of a character type and a non-conversion frequency of a character type; The step S31 comprises: The conversion frequency P of the character type is calculated by the following formula swich : The step S32 comprises: According to the diagonal elements of the transfer matrix A, the number of adjacent characters with the same category is represented. The character type non-conversion frequency P is calculated by the following formula: retain : The step S33 comprises: The transfer matrix transfer density coefficient S is calculated by the following formula:

2. A ciphertext determination system based on a transfer matrix, characterized in that: include: A reading module, used for reading the character string to be determined; A matrix construction module, used to construct a transfer matrix for the string to be determined; A statistical module is used to count the number of non-zero elements X in the transfer matrix. If X < 3, the character string to be determined is plain text. If X≥8, the string to be determined is a ciphertext; if 3≤X<8, the transfer matrix is ​​sent to the calculation module; A calculation module, used for calculating a transfer density coefficient S of a transfer matrix using a preset algorithm; A judgment module, used for judging whether the character string to be judged is ciphertext or plaintext according to the transfer density coefficient S; Output module, used to output and display the judgment result of the character string; The matrix building module is specifically used for: If the length of the string to be determined is d, construct the transfer matrix A, and the elements in the transfer matrix A are represented by A i,j , A i,j The initial value of is 0; i is the row number and j is the column number; Let row labels be: uppercase letters, lowercase letters, numbers, and special symbols; let column labels be: uppercase letters, lowercase letters, numbers, and special symbols; Determine the value of each element in the transfer matrix A according to the types of adjacent characters in the character string to be determined; Among them, A 1,1 A is the number of consecutive characters that are all uppercase letters. 1,2 is the number of uppercase and lowercase letters of adjacent characters, A 1,3 is the number of adjacent characters that are uppercase letters and numbers, A 1,4 is the number of adjacent characters that are uppercase letters and special symbols, A 2,1 is the number of lowercase and uppercase letters of adjacent characters, A 2,2 is the number of adjacent characters that are all lowercase letters, A 2,3 is the number of adjacent lowercase letters and numbers, A 2,4 is the number of adjacent lowercase letters and special symbols, A 3,1 The number of adjacent characters that are numbers or uppercase letters. 3,2 is the number of adjacent characters that are numbers or lowercase letters, A 3,3 is the number of adjacent characters that are all digits, A 3,4 is the number of adjacent characters that are numbers or special symbols, A 4,1 The number of adjacent characters that are special symbols or uppercase letters, A 4,2 is the number of adjacent characters that are special symbols or lowercase letters, A 4,3 is the number of adjacent characters that are special symbols or numbers, A 4,4 is the number of adjacent characters that are all special symbols; The method of calculating the transfer density coefficient S of the transfer matrix using a preset algorithm comprises the following steps: S31: Calculate the conversion frequency of the character type according to the constructed transfer matrix A; S32: Calculate the non-conversion frequency of the character type according to the constructed transfer matrix A; S33: Calculating a transfer density coefficient S of a transfer matrix according to a conversion frequency of a character type and a non-conversion frequency of a character type; The step S31 comprises: The conversion frequency P of the character type is calculated by the following formula swich : The step S32 comprises: According to the diagonal elements of the transfer matrix A, the number of adjacent characters with the same category is represented. The character type non-conversion frequency P is calculated by the following formula: retain : The step S33 comprises: The transfer matrix transfer density coefficient S is calculated by the following formula:

3. A ciphertext determination device based on a transfer matrix, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the ciphertext determination method based on the transfer matrix as claimed in claim 1 when executing the computer program.