Data processing method and related equipment

文档序号:409953 发布日期:2021-12-17 浏览:2次 中文

阅读说明:本技术 一种数据处理方法以及相关设备 (Data processing method and related equipment ) 是由 杨政 余鑫耸 肖彦婷 于 2021-09-16 设计创作,主要内容包括:本申请实施例公开了一种数据处理方法以及相关设备,用于节省存储空间。本申请实施例方法包括:获取原始字符串和目标位移量,原始字符串包括依次排列的多个原始字符;使用目标位移量分别对各个原始字符加密,得到与原始字符对应的加密字符;按照原始字符在原始字符串中的排列顺序排列多个加密字符,得到加密字符串;当加密字符串存在由多个相同的加密字符连续组成的一段字符时,将同一段多个相同的加密字符替换成一个相同的加密字符和一个特殊字符,生成压缩字符串,特殊字符用于表示加密字符在同一段内的连续出现次数。(The embodiment of the application discloses a data processing method and related equipment, which are used for saving storage space. The method in the embodiment of the application comprises the following steps: acquiring an original character string and a target displacement, wherein the original character string comprises a plurality of original characters which are sequentially arranged; encrypting each original character by using the target displacement respectively to obtain an encrypted character corresponding to the original character; arranging a plurality of encrypted characters according to the arrangement sequence of the original characters in the original character string to obtain an encrypted character string; when a section of character consisting of a plurality of same encrypted characters is continuously existed in the encrypted character string, the same section of the plurality of same encrypted characters are replaced by a same encrypted character and a special character to generate a compressed character string, and the special character is used for indicating the continuous occurrence times of the encrypted character in the same section.)

1. A data processing method, comprising:

acquiring an original character string and a target displacement, wherein the original character string comprises a plurality of original characters which are sequentially arranged;

encrypting each original character by using the target displacement respectively to obtain an encrypted character corresponding to the original character;

arranging a plurality of encrypted characters according to the arrangement sequence of the original characters in the original character string to obtain an encrypted character string;

when a section of character consisting of a plurality of same encrypted characters continuously exists in the encrypted character string, replacing the same encrypted characters with the same encrypted character and a special character to generate a compressed character string, wherein the special character is used for representing the continuous occurrence times of the encrypted characters in the same section.

2. The data processing method according to claim 1, wherein the obtaining a target displacement amount comprises:

acquiring a preset displacement, wherein the preset displacement is an integer;

judging whether the absolute value of the preset displacement is greater than 9;

if so, determining the target displacement amount as the preset displacement amount;

if not, determining that the target displacement is the remainder of dividing the preset displacement by 10.

3. The data processing method according to claim 1, wherein the encrypting each of the original characters using the target displacement amounts respectively to obtain encrypted characters corresponding to the original characters comprises:

summing each original character in the original character string consisting of numeric characters and the target displacement quantity to obtain a first transition numeric value;

judging whether the absolute value of the first transition numerical value is greater than 9;

if yes, taking 10 remainder of the first transition numerical value with the absolute value larger than 9 to obtain a second transition numerical value, and determining the second transition numerical value as the encrypted character;

and if not, determining the first transition numerical value as the encrypted character.

4. A data processing method, comprising:

acquiring a compressed character string;

when the compressed character string has special characters, determining the compressed characters corresponding to the special characters, wherein the special characters are used for representing the continuous occurrence times N of the compressed characters corresponding to the special characters;

replacing the special characters with compressed characters corresponding to the special characters with the number of N minus 1 to obtain an encrypted character string with a plurality of encrypted characters arranged in sequence;

acquiring a target displacement;

decrypting each encrypted character by using the target displacement respectively to obtain an original character corresponding to the encrypted character;

and arranging a plurality of original characters according to the arrangement sequence of the encrypted characters in the encrypted character string to obtain an original character string.

5. The data processing method according to claim 4, wherein the obtaining the target displacement amount comprises:

acquiring a preset displacement, wherein the preset displacement is an integer;

judging whether the absolute value of the preset displacement is greater than 9;

if so, determining the target displacement as the remainder of dividing the preset displacement by 10;

if not, determining the target displacement as the preset displacement.

6. The data processing method according to claim 4, wherein the decrypting each encrypted character using the target displacement amount to obtain an original character corresponding to the encrypted character comprises:

summing each encrypted character in the encrypted character string consisting of numeric characters and the target displacement respectively to obtain a third transition numeric value;

judging whether the absolute value of the third transition numerical value is greater than 9;

if yes, taking 10 remainder of the third transition numerical value with the absolute value larger than 9 to obtain a fourth transition numerical value, and determining the fourth transition numerical value as the original character;

and if not, determining the third transition numerical value as the original character.

7. A data processing apparatus for encrypting a compressed character string, comprising:

an acquisition unit configured to acquire an original character string and a target displacement amount, the original character string including a plurality of original characters arranged in sequence;

the encryption unit is used for encrypting each original character by using the target displacement respectively to obtain an encrypted character corresponding to the original character;

the arranging unit is used for arranging a plurality of encrypted characters according to the arrangement sequence of the original characters in the original character string to obtain an encrypted character string;

and the compression unit is used for replacing a same encrypted character with the same encrypted character and a special character to generate a compressed character string when the encrypted character string has a section of character consisting of a plurality of same encrypted characters in a continuous way, wherein the special character is used for representing the continuous occurrence times of the encrypted character in the same section.

8. A data processing apparatus for decrypting a decompressed string, the data processing apparatus comprising:

an acquisition unit configured to acquire a compressed character string;

the decompression unit is used for replacing the special character with at least one previous compressed character of the special character according to the occurrence frequency of the previous compressed character of the special character represented by the special character when the compressed character string has the special character, so that an encrypted character string with a plurality of encrypted characters sequentially arranged is obtained;

the acquisition unit is also used for acquiring a target displacement;

the decryption unit is used for decrypting each encrypted character by using the target displacement respectively to obtain an original character corresponding to the encrypted character;

and the arranging unit is used for arranging a plurality of original characters according to the arrangement sequence of the encrypted characters in the encrypted character string to obtain the original character string.

9. A data processing apparatus, comprising:

the system comprises a central processing unit, a memory and an input/output interface;

the memory is a transient memory or a persistent memory;

the central processor is configured to communicate with the memory and execute the instructions in the memory to perform the method of any of claims 1-6.

10. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method of any of claims 1 to 6.

Technical Field

The embodiment of the application relates to the field of computers, in particular to a data processing method and related equipment.

Background

Encryption and decryption of software is an attractive field of research and can be closely combined with almost any computer technology, namely cryptography, programming languages, operating systems and data structures. The existing common encryption technology is symmetric encryption, symmetric encryption adopts a symmetric cipher coding technology, and the method is characterized in that the same key is used for file encryption and decryption, namely, an encryption key can also be used as a decryption key. The Data Encryption Standard (DES) is a symmetric encryption technology.

At present, the character string is usually encrypted by a DES encryption algorithm, and after the encryption is finished, the character string is compressed by a GZip algorithm.

However, the length of the character string is increased by using the DES algorithm for encryption, even if the character string is encrypted and then compressed by using the GZip algorithm, the length of the character string exceeds the original length, and the length of the character string is increased after the encryption and compression are actually finished.

Disclosure of Invention

The embodiment of the application provides a data processing method for saving storage space.

A first aspect of an embodiment of the present application provides a data processing method, including:

acquiring an original character string and a target displacement, wherein the original character string comprises a plurality of original characters which are sequentially arranged;

encrypting each original character by using the target displacement respectively to obtain an encrypted character corresponding to the original character;

arranging a plurality of encrypted characters according to the arrangement sequence of the original characters in the original character string to obtain an encrypted character string;

when a section of character consisting of a plurality of same encrypted characters continuously exists in the encrypted character string, replacing the same encrypted characters with the same encrypted character and a special character to generate a compressed character string, wherein the special character is used for representing the continuous occurrence times of the encrypted characters in the same section.

Optionally, the obtaining the target displacement amount includes:

acquiring a preset displacement, wherein the preset displacement is an integer;

judging whether the absolute value of the preset displacement is greater than 9;

if so, determining the target displacement amount as the preset displacement amount;

if not, determining that the target displacement is the remainder of dividing the preset displacement by 10.

Optionally, the encrypting each original character by using the target displacement respectively to obtain an encrypted character corresponding to the original character includes:

summing each original character in the original character string consisting of numeric characters and the target displacement quantity to obtain a first transition numeric value;

judging whether the absolute value of the first transition numerical value is greater than 9;

if yes, taking 10 remainder of the first transition numerical value with the absolute value larger than 9 to obtain a second transition numerical value, and determining the second transition numerical value as the encrypted character;

and if not, determining the first transition numerical value as the encrypted character.

A second aspect of the embodiments of the present application provides a data processing method, including:

acquiring a compressed character string;

when the compressed character string has special characters, determining the compressed characters corresponding to the special characters, wherein the special characters are used for representing the continuous occurrence times N of the compressed characters corresponding to the special characters;

replacing the special characters with compressed characters corresponding to the special characters with the number of N minus 1 to obtain an encrypted character string with a plurality of encrypted characters arranged in sequence;

acquiring a target displacement;

decrypting each encrypted character by using the target displacement respectively to obtain an original character corresponding to the encrypted character;

and arranging a plurality of original characters according to the arrangement sequence of the encrypted characters in the encrypted character string to obtain an original character string.

Optionally, the obtaining the target displacement amount includes:

acquiring a preset displacement, wherein the preset displacement is an integer;

judging whether the absolute value of the preset displacement is greater than 9;

if so, determining the target displacement as the remainder of dividing the preset displacement by 10;

if not, determining the target displacement as the preset displacement.

Optionally, the decrypting each encrypted character by using the target displacement respectively to obtain the original character corresponding to the encrypted character includes:

summing each encrypted character in the encrypted character string consisting of numeric characters and the target displacement respectively to obtain a third transition numeric value;

judging whether the absolute value of the third transition numerical value is greater than 9;

if yes, taking 10 remainder of the third transition numerical value with the absolute value larger than 9 to obtain a fourth transition numerical value, and determining the fourth transition numerical value as the original character;

and if not, determining the third transition numerical value as the original character.

A third aspect of the embodiments of the present application provides a data processing apparatus, including:

an acquisition unit configured to acquire an original character string and a target displacement amount, the original character string including a plurality of original characters arranged in sequence;

the encryption unit is used for encrypting each original character by using the target displacement respectively to obtain an encrypted character corresponding to the original character;

the arranging unit is used for arranging a plurality of encrypted characters according to the arrangement sequence of the original characters in the original character string to obtain an encrypted character string;

and the compression unit is used for replacing a same encrypted character with the same encrypted character and a special character to generate a compressed character string when the encrypted character string has a section of character consisting of a plurality of same encrypted characters in a continuous way, wherein the special character is used for representing the continuous occurrence times of the encrypted character in the same section.

Optionally, the obtaining unit is specifically configured to:

acquiring a preset displacement, wherein the preset displacement is an integer;

judging whether the absolute value of the preset displacement is greater than 9;

if so, determining the target displacement amount as the preset displacement amount;

if not, determining that the target displacement is the remainder of dividing the preset displacement by 10.

Optionally, the encryption unit is specifically configured to:

summing each original character in the original character string consisting of numeric characters and the target displacement quantity to obtain a first transition numeric value;

judging whether the absolute value of the first transition numerical value is greater than 9;

if yes, taking 10 remainder of the first transition numerical value with the absolute value larger than 9 to obtain a second transition numerical value, and determining the second transition numerical value as the encrypted character;

and if not, determining the first transition numerical value as the encrypted character.

A fourth aspect of the present embodiment provides a data processing apparatus, including:

an acquisition unit configured to acquire a compressed character string;

the determining unit is used for determining a compressed character corresponding to a special character when the compressed character string has the special character, wherein the special character is used for indicating the continuous occurrence frequency N of the compressed character corresponding to the special character;

the decompression unit is used for replacing the special characters with compressed characters corresponding to the special characters with the number of N minus 1 to obtain an encrypted character string with a plurality of encrypted characters arranged in sequence;

the acquisition unit is also used for acquiring a target displacement;

the decryption unit is used for decrypting each encrypted character by using the target displacement respectively to obtain an original character corresponding to the encrypted character;

and the arranging unit is used for arranging a plurality of original characters according to the arrangement sequence of the encrypted characters in the encrypted character string to obtain the original character string.

Optionally, the obtaining unit is specifically configured to:

acquiring a preset displacement, wherein the preset displacement is an integer;

judging whether the absolute value of the preset displacement is greater than 9;

if so, determining the target displacement as the remainder of dividing the preset displacement by 10;

if not, determining the target displacement as the preset displacement.

Optionally, the decryption unit is specifically configured to:

summing each encrypted character in the encrypted character string consisting of numeric characters and the target displacement respectively to obtain a third transition numeric value;

judging whether the absolute value of the third transition numerical value is greater than 9;

if yes, taking 10 remainder of the third transition numerical value with the absolute value larger than 9 to obtain a fourth transition numerical value, and determining the fourth transition numerical value as the original character;

and if not, determining the third transition numerical value as the original character.

A fifth aspect of the embodiments of the present application provides a data processing apparatus, including:

the system comprises a central processing unit, a memory and an input/output interface;

the memory is a transient memory or a persistent memory;

the central processing unit is configured to communicate with the memory and execute the instruction operations in the memory to execute the data processing method provided in the first aspect to the second aspect of the embodiments of the present application.

The computer-readable storage medium provided by the embodiment of the present application includes instructions, which when executed on a computer, cause the computer to execute the data processing method provided by the first aspect and the second aspect of the embodiment of the present application.

According to the technical scheme, the embodiment of the application has the following advantages: the length of the encrypted character string is consistent with that of the original character string, the length of the compressed character string is smaller than or equal to that of the original character string, the length of the compressed character string after encryption and compression is not larger than that of the original character string, and storage space can be better saved.

Drawings

Fig. 1 is a schematic flow chart of a data processing method according to an embodiment of the present application:

FIG. 2 is another schematic flow chart of a data processing method according to an embodiment of the present application;

FIG. 3 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application;

FIG. 4 is a schematic diagram of another embodiment of a data processing apparatus;

fig. 5 is another schematic structural diagram of a data processing apparatus according to an embodiment of the present application.

Detailed Description

The embodiment of the application provides a data processing method for saving storage space.

Referring to fig. 1, an embodiment of a data processing method according to the embodiment of the present application includes:

101. and acquiring an original character string and a target displacement, wherein the original character string comprises a plurality of original characters which are sequentially arranged.

When a certain character string needs to be encrypted, an original character string formed by arranging a plurality of original characters and a target displacement are obtained first, and then the original character string is encrypted through the target displacement.

102. And respectively encrypting each original character by using the target displacement to obtain an encrypted character corresponding to the original character.

And encrypting each original character in the original character string by using the target displacement to obtain a plurality of encrypted characters corresponding to the original characters one by one.

103. And arranging a plurality of encrypted characters according to the arrangement sequence of the original characters in the original character string to obtain the encrypted character string.

Each encrypted character has a corresponding original character, and each original character is arranged according to a certain sequence to form an original character string, so that a plurality of encrypted characters are arranged according to the arrangement sequence of the corresponding original characters in the original character string to form the encrypted character string.

104. When a section of character consisting of a plurality of same encrypted characters is continuously existed in the encrypted character string, the same section of the plurality of same encrypted characters are replaced by a same encrypted character and a special character to generate a compressed character string, and the special character is used for indicating the continuous occurrence times of the encrypted character in the same section.

When a segment of characters consisting of a plurality of identical encrypted characters in succession exists in the encrypted character string, the segment of continuous characters can be replaced by one special character and one identical encrypted character through the special character used for indicating the continuous occurrence times of the encrypted characters in the same segment, so that the compression effect is realized. Specifically, the sequence of the special character and the same encrypted character is not limited. In addition, the special character may be any character that does not appear in the encrypted character string preset by the system or the user in advance, and is not limited herein.

In practical application, when replacing a certain continuous character, a compression position mark is also added for indicating the encrypted character replaced by the special character. Specifically, the compressed location identifier may be disposed between, before or after the special character and the encrypted character, and is not limited herein.

In the embodiment of the application, the length of the encrypted character string is consistent with that of the original character string, the length of the compressed character string is less than or equal to that of the original character string, the length of the compressed character string after encryption and compression is completed is not greater than that of the original character string, under the condition that the same content is stored in an encrypted mode, more space cannot be used, and storage space can be better saved.

Another flow of the data processing method in the embodiment of the present application includes the above steps 101 to 104, where the step 101 is specifically implemented by the following method: acquiring a preset displacement, wherein the preset displacement is an integer; judging whether the absolute value of the preset displacement is greater than 9; if so, determining the target displacement as the remainder of dividing the preset displacement by 10; if not, determining the target displacement as the preset displacement.

Specifically, before determining the target displacement, a preset displacement is required to be obtained, where the preset displacement may be any integer. In addition, the preset displacement may be preset by a system or preset by a user, and is not limited herein.

Then judging whether the acquired range of the preset displacement is beyond [ -9,9] or not, and dividing the preset displacement by 10 when the range of the preset displacement is beyond [ -9,9] to obtain a remainder which is the target displacement; when the value range of the preset displacement is within [ -9,9], the preset displacement is determined to be the target displacement.

In addition, step 102 is specifically implemented by: summing each original character in an original character string consisting of numerical characters and a target displacement quantity respectively to obtain a first transition numerical value; judging whether the absolute value of the first transition value is greater than 9; if yes, taking 10 remainder of the first transition numerical value with the absolute value larger than 9 to obtain a second transition numerical value, and determining the second transition numerical value as an encrypted character; if not, the first transition numerical value is determined as the encrypted character.

Specifically, each original character in the original character string is subjected to the same encryption processing, that is, each original character is summed with the target displacement amount, so as to obtain a first transition value corresponding to the original character one to one. When the target displacement is a positive integer or zero, summing the target displacement into addition; when the target displacement is a negative integer, the summation is a subtraction, and is not limited herein.

Then, judging whether the value range of each first transition numerical value is beyond the range of [ -9,9], dividing the first transition numerical value by 10 when the value range of a certain first transition numerical value is beyond the range of [ -9,9], obtaining a remainder as a second transition numerical value, and determining the second transition numerical value as an encrypted character corresponding to the corresponding original character; and when the value range of a certain first transition value is in [ -9,9], determining that the first transition value is the encrypted character corresponding to the corresponding original character. In practical situations, each original character in the original character string is encrypted, and the aforementioned determining step is performed.

In the embodiment of the application, the confirmation mode of the target displacement and the specific implementation mode of encryption processing are further limited, and the realizability of the scheme is improved.

The embodiment of the application provides a data processing method which is used for reading a character string after encryption and compression processing.

Referring to fig. 2, an embodiment of a data processing method according to the embodiment of the present application includes:

201. and acquiring the compressed character string.

When the content processed by the data processing method needs to be read, the compressed character string processed by the data processing method is acquired first.

202. And when the compressed character string has the special character, determining the compressed character corresponding to the special character, wherein the special character is used for indicating the continuous occurrence number N of the compressed character corresponding to the special character.

And if the obtained compressed character string has the special character, determining the character replaced by the special character according to the compression position identifier. The compression position identifier may be placed between, before or after the special character and the encrypted character corresponding to the special character, and is not limited herein. The special character indicates the number of occurrences N of the replaced compressed character corresponding to the special character.

203. And replacing the special characters with compressed characters corresponding to the special characters with the number of N minus 1 to obtain an encrypted character string with a plurality of encrypted characters arranged in sequence.

According to the determined compressed character corresponding to the special character, replacing the special character with the compressed character corresponding to the special character with the number of N minus 1, specifically, if the occurrence frequency of the corresponding compressed character represented by the special character is 3, replacing the special character with 2 corresponding compressed characters. Specifically, the sequence of the special character and the same encrypted character is not limited.

204. And acquiring the target displacement.

And acquiring the target displacement amount, and decrypting the encrypted character string through the target displacement amount.

In practice, the target displacement amount obtained in this step coincides with the target displacement amount used when encrypting the character string.

205. And decrypting each encrypted character by using the target displacement respectively to obtain an original character corresponding to the encrypted character.

And decrypting each encrypted character in the original character string by using the target displacement to obtain a plurality of original characters corresponding to the encrypted characters one by one.

206. And arranging a plurality of original characters according to the arrangement sequence of the encrypted characters in the encrypted character string to obtain the original character string.

Each original character has a corresponding encrypted character, and each encrypted character is arranged according to a certain sequence to form an encrypted character string, so that a plurality of original characters are arranged according to the arrangement sequence of the corresponding encrypted characters in the encrypted character string to form the original character string.

In the embodiment of the application, the character string processed by the data processing method can be decrypted and decompressed according to the corresponding target displacement and the special character, so that the encrypted and compressed character string can be read conveniently.

Another flow of the data processing method according to the embodiment of the present application includes the above steps 201 to 206,

wherein step 204 is specifically implemented by: acquiring a preset displacement, wherein the preset displacement is an integer; judging whether the absolute value of the preset displacement is greater than 9; if so, determining the target displacement as the remainder of dividing the preset displacement by 10; if not, determining the target displacement as the preset displacement.

The specific implementation manner of step 204 in this embodiment is similar to the specific implementation manner of step 101, and is not described herein again.

In addition, step 205 is specifically implemented by the following means: summing each encrypted character in an encrypted character string consisting of numerical characters and a target displacement quantity respectively to obtain a third transition numerical value; judging whether the absolute value of the third transition value is greater than 9; if yes, taking 10 remainder of a third transition numerical value with the absolute value larger than 9 to obtain a fourth transition numerical value, and determining the fourth transition numerical value as an original character; if not, determining the third transition numerical value as the original character.

Specifically, each encrypted character in the encrypted character string is subjected to the same encryption processing, that is, each encrypted character is summed with the target displacement amount, so as to obtain a third transition value corresponding to the encrypted character one to one. When the target displacement is a positive integer or zero, summing the target displacement into addition; when the target displacement is a negative integer, the summation is a subtraction, and is not limited herein.

Then, judging whether the value range of each third transition numerical value is beyond the range of [ -9,9], dividing the third transition numerical value by 10 when the value range of a certain third transition numerical value is beyond the range of [ -9,9], obtaining a remainder as a fourth transition numerical value, and determining the fourth transition numerical value as the original character corresponding to the corresponding encrypted character; and when the value range of a certain third transition value is in [ -9,9], determining that the third transition value is the original character corresponding to the corresponding encrypted character.

In practical situations, the foregoing determining step is performed to decrypt each encrypted character in the encrypted character string.

In the embodiment of the application, a confirmation mode of the target displacement and a specific implementation mode of decryption processing are further defined, and the realizability of the scheme is improved.

For convenience of understanding, the following description will be made of the processes of encrypting, compressing, decompressing and decrypting a character string, with reference to specific cases:

the existing character string "100000,100002,100008" needs to be encrypted and compressed.

First, setting the displacement amount to be 2, the result of adding the numeric characters in the character string "100000,100002,100008" to "2" respectively is "322222,322224,322220", wherein if the addition result is greater than or equal to 10, the remainder of division by 10, for example, "8 +2 ═ 10", the remainder of 10 is taken to be 0.

And then compressing the encrypted character, and setting that the times of the same character occurrence are replaced by letters, such as that "b" represents 2 times of occurrence, "c" represents 3 times of occurrence, "d" represents 4 times of occurrence, and the like, and the characters which are used for replacement are replaced by unused characters which occur only once, wherein the characters which are used for replacement cannot appear in the original characters. Based on the foregoing, the result of compressing the encrypted character string "322222,322224,322220" is "32 e,32d4,32d 0", based on which the encrypted compression of the character is completed.

When the encrypted and compressed character string needs to be read, the character string needs to be decrypted and decompressed to restore the original character string.

Decompression is first carried out, and according to the above, the "2 e" is reduced to "22222" and the "2 d" is reduced to "2222", and the result is "322222,322224,322220".

And then, decrypting the encrypted character string '322222,322224,322220', subtracting the displacement from the numeric characters to obtain '100000,100002,100008', wherein the subtraction result is less than 0, the positive integer is taken, the positive integer is greater than or equal to 10, the remainder is taken, which is obtained by dividing by 10, for example, the positive integer of-8 is taken as 8, and based on the result, the decompression and decryption of the characters are completed.

With reference to fig. 3, the data processing method according to the embodiment of the present application is described above, and a data processing apparatus according to the embodiment of the present application is described below, where an embodiment of the data processing apparatus according to the embodiment of the present application includes:

an obtaining unit 301, configured to obtain an original character string and a target displacement amount, where the original character string includes a plurality of original characters arranged in sequence;

an encrypting unit 302, configured to encrypt each original character using the target displacement amount, respectively, to obtain an encrypted character corresponding to the original character;

an arranging unit 303, configured to arrange a plurality of encrypted characters according to an arrangement order of the original characters in the original character string, so as to obtain an encrypted character string;

a compressing unit 304, configured to, when there is a segment of the encrypted character string that is composed of a plurality of identical encrypted characters in succession, replace the identical encrypted characters with an identical encrypted character and a special character to generate a compressed character string, where the special character is used to indicate the number of times the encrypted character appears in succession in the identical segment.

Optionally, the obtaining unit 301 is specifically configured to:

acquiring a preset displacement, wherein the preset displacement is an integer;

judging whether the absolute value of the preset displacement is greater than 9;

if so, determining the target displacement as a preset displacement;

if not, determining the target displacement as the remainder of dividing the preset displacement by 10.

Optionally, the encryption unit 302 is specifically configured to:

summing each original character in an original character string consisting of numerical characters and a target displacement quantity respectively to obtain a first transition numerical value;

judging whether the absolute value of the first transition value is greater than 9;

if yes, taking 10 remainder of the first transition numerical value with the absolute value larger than 9 to obtain a second transition numerical value, and determining the second transition numerical value as an encrypted character;

if not, the first transition numerical value is determined as the encrypted character.

In the embodiment of the present application, the length of the encrypted character string encrypted by the encryption unit 302 is consistent with the length of the original character string, the length of the compressed character string compressed by the compression unit 304 is less than or equal to the length of the original character string, the length of the compressed character string after completing encryption and compression is not greater than the length of the original character string, and under the condition of storing the same content by encryption, more space is not used, so that the storage space can be better saved.

Referring to fig. 4, another embodiment of a data processing apparatus according to the embodiment of the present application includes:

an obtaining unit 401 configured to obtain a compressed character string;

a determining unit 402, configured to determine, when a special character exists in the compressed character string, a compressed character corresponding to the special character, where the special character is used to indicate a consecutive occurrence number N of the compressed character corresponding to the special character;

a decompression unit 403, configured to replace the special character with a compressed character corresponding to the special character whose number is N minus 1, so as to obtain an encrypted character string in which a plurality of encrypted characters are sequentially arranged;

the acquiring unit 401 is further configured to acquire a target displacement;

a decryption unit 404, configured to decrypt each encrypted character using the target displacement amount, respectively, to obtain an original character corresponding to the encrypted character;

an arranging unit 405, configured to arrange a plurality of original characters according to an arrangement order of the encrypted characters in the encrypted character string, so as to obtain an original character string.

Optionally, the obtaining unit 401 is specifically configured to:

acquiring a preset displacement, wherein the preset displacement is an integer;

judging whether the absolute value of the preset displacement is greater than 9;

if so, determining the target displacement as the remainder of dividing the preset displacement by 10;

if not, determining the target displacement as the preset displacement.

Optionally, the decryption unit 404 is specifically configured to:

summing each encrypted character in an encrypted character string consisting of numerical characters and a target displacement quantity respectively to obtain a third transition numerical value;

judging whether the absolute value of the third transition value is greater than 9;

if yes, taking 10 remainder of a third transition numerical value with the absolute value larger than 9 to obtain a fourth transition numerical value, and determining the fourth transition numerical value as an original character;

if not, determining the third transition numerical value as the original character.

In this embodiment, the uncompressing unit 403 and the decrypting unit 404 may respectively decrypt and decompress the character string processed by the foregoing data processing method according to the corresponding target displacement and the special character, so as to facilitate reading the encrypted and compressed character string.

Fig. 5 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present disclosure, where the data processing apparatus 500 may include one or more Central Processing Units (CPUs) 501 and a memory 505, and the memory 505 stores one or more application programs or data therein.

Memory 505 may be volatile storage or persistent storage, among others. The program stored in memory 505 may include one or more modules, each of which may include a sequence of instructions operating on a data processing apparatus. Still further, the central processor 501 may be arranged to communicate with the memory 505 to execute a series of instruction operations in the memory 505 on the data processing apparatus 500.

The data processing device 500 may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input-output interfaces 504, and/or one or more operating systems, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

The central processing unit 501 may perform the operations performed by the data processing apparatus in the embodiments shown in fig. 1 to fig. 4, and details thereof are not repeated herein.

It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.

In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.

The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种用于在量子密钥分发中实现隐私放大的方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!