CN114091070A - Hilbert transform-based ciphertext generation method, server, medium, and apparatus - Google Patents

Hilbert transform-based ciphertext generation method, server, medium, and apparatus Download PDF

Info

Publication number
CN114091070A
CN114091070A CN202111404967.2A CN202111404967A CN114091070A CN 114091070 A CN114091070 A CN 114091070A CN 202111404967 A CN202111404967 A CN 202111404967A CN 114091070 A CN114091070 A CN 114091070A
Authority
CN
China
Prior art keywords
value
ciphertext
module
data blocks
initial value
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.)
Pending
Application number
CN202111404967.2A
Other languages
Chinese (zh)
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.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202111404967.2A priority Critical patent/CN114091070A/en
Publication of CN114091070A publication Critical patent/CN114091070A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/14Fourier, Walsh or analogous domain transformations, e.g. Laplace, Hilbert, Karhunen-Loeve, transforms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/20Manipulating the length of blocks of bits, e.g. padding or block truncation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Data Mining & Analysis (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Power Engineering (AREA)
  • Bioethics (AREA)
  • Computer Hardware Design (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The application discloses a ciphertext generation method, a server, a medium and a device based on Hilbert transform, which can be applied to the field of block chains or the field of finance. After the input information is obtained, the input information is encrypted to obtain a first ciphertext, and then SHA-1 algorithm encryption is carried out on the first ciphertext. In the application, if a first message corresponding to input information is divided into a plurality of data blocks, in the process of calculating the next data block, the initial value of the buffer corresponding to the next data block is the final value of the buffer of the previous data block, that is, the obtained second ciphertext is not only related to the first ciphertext but also related to the number of the divided data blocks of the first message, if brute force cracking is performed, the number of the divided data blocks of the first message and the first ciphertext need to be cracked, and brute force cracking is more difficult, so that the safety is improved.

Description

Ciphertext generating method, server, medium, and apparatus based on Hilbert transform
Technical Field
The present application relates to the field of block chain technology, and more particularly, to a ciphertext generation method, server, medium, and apparatus based on hilbert transform.
Background
SHA-1(Secure Hash Algorithm 1) is a function for generating 160-bit ciphertext and is widely applied in the prior art, but with the continuous development of computer computing capacity, security personnel have successfully broken the SHA-1 Algorithm.
Therefore, how to strengthen the existing SHA-1 is a necessary requirement for the technical development.
Disclosure of Invention
In view of the above, the present application provides a ciphertext generation method, a server, a medium, and an apparatus based on hilbert transform.
In order to achieve the above purpose, the present application provides the following technical solutions:
according to a first aspect of the embodiments of the present disclosure, there is provided a ciphertext generation method based on hilbert transform, including:
acquiring input information to be stored to a block chain;
converting the input information into decimal ASCII codes to obtain a first character string consisting of the decimal ASCII codes;
obtaining M coordinates from the first character string, wherein the abscissa of the coordinates is the position of the first character string, the ordinate of the coordinates is the character at the position, and the total number of characters contained in the first character string is M;
using a fitting toolbox for the M coordinates, obtaining a first segmentation function:
Figure BDA0003371959170000011
{k0≤t<k1,i=1;k1≤t<k2,i=2;...;kn-1≤t<kn,i=n};
performing Hilbert transform on the piecewise function to obtain a second piecewise function;
sampling values from a second piecewise function to obtain M discrete values so as to obtain a first ciphertext consisting of the M discrete values;
expanding the length complementary bit of the first ciphertext into 512 bits x Q to obtain a first message, wherein Q is any integer greater than or equal to 1;
dividing the first message into Q data blocks, wherein the number of bits of the data blocks is 512 bits;
setting the initial value of G to be 1;
the following operations are performed for the G-th data block:
dividing the data block into 16 target sub data blocks, wherein the number of bits of the target sub data blocks is 32;
performing operation on the 16 target sub data blocks to obtain 64 operation sub data blocks so as to obtain 80 sub data blocks, wherein the bit number of the operation sub data blocks is 32 bits, and the 80 sub data blocks comprise the 16 target sub data blocks and the 64 operation sub data blocks;
obtaining preset 80 constants Kt(ii) a t takes the values of 0, 1,2, … and 79;
obtaining an identity of a buffer H0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4An initial value of (1);
h is to be0Of (d), H1Of (d), H2Of (d), H3Of (d), H4Respectively assigning the initial values to a first parameter, a second parameter, a third parameter, a fourth parameter and a fifth parameter;
setting the initial value of P to be 0;
for t ═ P, the following calculation is performed:
TEMP=S5(H0)+ft(H1,H2,H3)+H4+Wt+Kt;H4=H3;H3=H2;H2=S30(H1);H1=H0;H0TEMP; wherein, WtFor the t +1 th sub-data block of the 80 sub-data blocks, ft(H1,H2,H3) Is a preset function; s5(H0) Means that H is0Left shift by 5; s30(H1) Means that H is1Left shift by 30;
setting P +1, returning to the step for t P, the following calculation is performed until P equals 80 to obtain the identification H of the buffer area0Value of (A), H1Value of (A), H2Value of (H)3Value of (A), H4A value of (d);
let H0Final value of ═ H0Value of + first parameter, H1Final value of ═ H1Value of + second parameter, H2Final value of ═ H2Value of + third parameter, H3Final value of (H)3Value of + fourth parameter, H4Final value of ═ H4The value of + the fifth parameter;
subjecting said H to0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (a), H4Respectively as the mark H of the buffer corresponding to the G +1 th data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4An initial value of (1);
setting G to G +1, and returning to the step to execute the following operations on the G-th data block until G is larger than Q;
according to H0、H1、H2、H3、H4In the order of (1) to obtain H0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (1), H4160 bit hash value;
obtaining a second ciphertext based on the 160-bit hash value;
storing the second ciphertext to a blockchain.
According to a second aspect of the embodiments of the present disclosure, there is provided a ciphertext generating apparatus based on a hilbert transform, including:
the first acquisition module is used for acquiring input information to be stored to the block chain;
a first conversion module for converting the input information into decimal ASCII codes to obtain a first character string composed of the decimal ASCII codes;
a second obtaining module, configured to obtain M coordinates from the first character string, where an abscissa of the coordinate is a position in the first character string, an ordinate of the coordinate is a character at the position, and a total number of characters included in the first character string is M;
a third obtaining module, configured to obtain a first segmentation function by using a fitting toolbox for the M coordinates:
Figure BDA0003371959170000031
{k0≤t<k1,i=1;k1≤t<k2,i=2;...;kn-1≤t<kn,i=n};
the second conversion module is used for performing Hilbert transform on the piecewise function to obtain a second piecewise function;
the fourth obtaining module is used for sampling values from the second piecewise function to obtain M discrete values so as to obtain a first ciphertext formed by the M discrete values;
a bit complement expansion module, configured to expand the length bit complement of the first ciphertext into 512 bits × Q to obtain a first packet, where Q is any integer greater than or equal to 1;
the first dividing module is used for dividing the first message into Q data blocks, and the bit number of each data block is 512 bits;
the first setting module is used for setting the initial value of G to be 1;
the following operations are performed for the G-th data block:
the second dividing module is used for dividing the data block into 16 target sub data blocks, and the number of bits of each target sub data block is 32;
the operation module is used for performing operation on the 16 target sub data blocks to obtain 64 operation sub data blocks so as to obtain 80 sub data blocks, the bit number of each operation sub data block is 32 bits, and the 80 sub data blocks comprise 16 target sub data blocks and 64 operation sub data blocks;
a fifth obtaining module, configured to obtain preset 80 constants Kt(ii) a t takes the values of 0, 1,2, … and 79;
a sixth obtaining module, configured to obtain an identifier H of the buffer0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4An initial value of (1);
a first assignment module for assigning H0Of (d), H1Of (d), H2Of (d), H3Of (d), H4Respectively assigning the initial values to a first parameter, a second parameter, a third parameter, a fourth parameter and a fifth parameter;
the second assignment module is used for setting the initial value of P to be 0;
a calculation module for performing the following calculation for t ═ P:
TEMP=S5(H0)+ft(H1,H2,H3)+H4+Wt+Kt;H4=H3;H3=H2;H2=S30(H1);H1=H0;H0TEMP; wherein, WtFor the t +1 th sub-data block of the 80 sub-data blocks, ft(H1,H2,H3) Is a preset function; s5(H0) Means that H is0Left shift by 5; s30(H1) Means that H is1Left shift by 30;
a first trigger module for setting P +1 and returning to the calculation module until P equals 80 to obtainIdentification H to the buffer0Value of (A), H1Value of (H)2Value of (A), H3Value of (A), H4A value of (d);
a third assignment module for ordering H0Final value of (H)0Value of + first parameter, H1Final value of ═ H1Value of + second parameter, H2Final value of ═ H2Value of + third parameter, H3Final value of ═ H3Value of + fourth parameter, H4Final value of ═ H4The value of + the fifth parameter;
a fourth assignment module to assign H to the data0Final value of (1), H1Final value of (1), H2Final value of (a), H3Final value of (1), H4Respectively as the mark H of the buffer corresponding to the G +1 th data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4An initial value of (1);
the second trigger module is used for setting G +1 and returning to the second dividing module until G is larger than Q;
a seventh obtaining module for obtaining according to H0、H1、H2、H3、H4In the order of (1) to obtain H0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (a), H4A 160-bit hash value;
an eighth obtaining module, configured to obtain a ciphertext based on the 160-bit hash value;
and the storage module is used for storing the ciphertext to the block chain.
According to a third aspect of the embodiments of the present disclosure, there is provided a server, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the Hilbert transform based ciphertext generation method of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium in which instructions, when executed by a processor of a server, enable the server to perform the hilbert transform-based ciphertext generation method as described in the first aspect.
According to a fifth aspect of the embodiments of the present disclosure, there is provided a computer program product directly loadable into an internal memory of a computer, the memory is included in the server shown in the third aspect and contains software codes, and the computer program can realize the ciphertext generation method based on hilbert transform as described in the first aspect after being loaded and executed by the computer.
According to the technical scheme, after the input information is obtained, the ciphertext generating method based on the Hilbert transform firstly encrypts the input information, and the encryption process is as follows: converting the input information into decimal ASCII codes to obtain a first character string consisting of the decimal ASCII codes; obtaining M coordinates from the first character string, wherein the abscissa of the coordinates is the position of the first character string, the ordinate of the coordinates is the character at the position, and the total number of characters contained in the first character string is M; using a fitting toolbox for the M coordinates, obtaining a first segmentation function:
Figure BDA0003371959170000051
{k0≤t<k1,i=1;k1≤t<k2,i=2;...;kn-1≤t<kni ═ n }; performing Hilbert transform on the piecewise function to obtain a second piecewise function; sampling values from a second piecewise function to obtain M discrete values so as to obtain a first ciphertext consisting of the M discrete values; and then, SHA-1 algorithm encryption is carried out on the first ciphertext, and even if an attacker decrypts the first ciphertext through SHA-1, the first ciphertext is still the encrypted ciphertext, so that the input information cannot be obtained through decryption, and the safety is improved. And if the first message is divided into a plurality of data blocks in the application, the first message is divided into a plurality of data blocksIn the process of calculating the next data block, the identifier H of the buffer area corresponding to the next data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4Is the initial value of H obtained for the last data block0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (1), H4The obtained second ciphertext is related to the process of encrypting the input information to obtain the first ciphertext and the number of the divided data blocks of the first message, if brute force cracking is needed, the number of the divided data blocks of the first message needs to be tried to be cracked, and the process of encrypting the input information to obtain the first ciphertext needs to be cracked.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a block chain apparatus according to an embodiment of the present disclosure;
fig. 2 is a block chain structure diagram provided in an embodiment of the present application;
fig. 3 is a flowchart of a ciphertext generation method based on hilbert transform according to an embodiment of the present application;
fig. 4a to 4c are schematic diagrams illustrating the input information bit complement expansion provided in the embodiment of the present application;
FIG. 5 is a schematic diagram of the data block being divided into 16 target sub data blocks;
fig. 6 is a structural diagram of a ciphertext generating apparatus based on hilbert transform according to an embodiment of the present application;
FIG. 7 is a block diagram illustrating an apparatus for a server in accordance with an example embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
The embodiment of the application provides a ciphertext generation method, a ciphertext generation device, a ciphertext generation server, a ciphertext generation medium and a ciphertext generation product based on Hilbert transform, and before introducing the technical scheme provided by the embodiment of the application, an application environment related to the embodiment of the application is explained.
Fig. 1 is a block chain apparatus according to an embodiment of the present disclosure.
The blockchain apparatus comprises a plurality of nodes 11, which may be electronic devices or servers.
For example, the electronic device may be any electronic product that can interact with a user through one or more ways such as a keyboard, a touch PAD, a touch screen, a remote controller, a voice interaction device, or a handwriting device, for example, a mobile phone, a notebook computer, a tablet computer, a palm computer, a personal computer, a wearable device, a smart television, a PAD, and the like.
The server may be, for example, one server, a server cluster composed of a plurality of servers, or a cloud computing server center. The server may include a processor, memory, and a network interface, among others.
The plurality of nodes included in the block chain device respectively store one same block chain.
For any node in the plurality of nodes, the node stores the node identifiers of other nodes in the blockchain device, so that the generated block is broadcasted to other nodes in the blockchain device according to the other node identifiers.
In order to make the embodiments of the present application more understandable to those skilled in the art, the structure of the blockchain is described in detail below.
As shown in fig. 2, the blockchain is composed of a plurality of blocks. The starting block comprises a block head and a block main body, wherein the block head stores an input information characteristic value, a version number, a timestamp and a difficulty value, and the block main body stores input information; the next block of the starting block takes the starting block as a parent block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the parent block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain is associated with the block data stored in the parent block, and the safety of the input information in the block is ensured.
When each block in the block chain is generated, when the node where the block chain is located receives input information, the SHA-1 algorithm needs to be carried out on the input information for calculation, and the obtained 160-bit ciphertext is used as a characteristic value of the input information and is stored to the head of the block. And after obtaining the block main body and the block head, obtaining the current block, then respectively sending the newly generated blocks to other nodes by the node where the block chain is located according to the node identifications of the other nodes, verifying the newly generated blocks by the other nodes, and adding the newly generated blocks to the block chain stored in the newly generated blocks after the verification is finished.
With the continuous development of computer computing power and the continuous accumulation of collision password libraries in the application process of the SHA-1 algorithm, the ciphertext generated by the SHA-1 algorithm has the possibility of being cracked violently. If the SHA-1 algorithm is replaced by other algorithms, for example, the SHA-2 algorithm, to prevent the ciphertext generated by the SHA-1 algorithm from being violently cracked, but the SHA-2 algorithm generates 256-bit ciphertext, that is, the length of the ciphertext is different from the length of 160-bit ciphertext generated by the SHA-1 algorithm, the improvement will affect the interface and the message format, improve the transformation cost, and have high difficulty.
The embodiment of the application provides an improved method for SHA-1, so that the length of a ciphertext obtained by an improved SHA-1 algorithm is still 160 bits, an interface and a message format do not need to be improved, and the reconstruction cost is reduced.
The ciphertext generating method based on the Hilbert transform provided by the embodiment of the application can be applied to any application scene using SHA-1, for example, a calculation scene of a characteristic value of transaction data of a bank. The input information is different in different application scenes, such as in the calculation scene of the characteristic value of the transaction data of a bank, and the input information is the transaction data.
The ciphertext generating method based on the hilbert transform provided in the embodiments of the present application is described below.
As shown in fig. 3, a flowchart of a ciphertext generation method based on hilbert transform according to an embodiment of the present application includes the following steps S301 to S324.
Step S301: input information to be stored to a blockchain is obtained.
For example, the input information may be transaction data. Such as transfer transaction data.
Step S302: the input information is converted into decimal ASCII code to obtain a first character string composed of the decimal ASCII code.
For example, the input information may be binary or hexadecimal.
Step S303: obtaining M coordinates from the first character string, wherein the abscissa of the coordinates is the position of the first character string, the ordinate of the coordinates is the character at the position, and the total number of characters contained in the first character string is M.
Assuming that the first character string is { J1, J2, J3, J4, J5, J6}, M is 6, and 6 coordinates are (1, J1), (2, J2), (3, J3), (4, J4), (5, J5), and (6, J6), respectively.
Step S304: using a fitting toolbox for the M coordinates, obtaining a first segmentation function:
Figure BDA0003371959170000091
{k0≤t<k1,i=1;k1≤t<k2,i=2;...;kn-1≤t<kn,i=n}。
illustratively, the fitting kit may be a cftool kit.
It will be appreciated that after fitting by the fitting kit, a first piecewise function of a finite number of trigonometric functions may be obtained, where n represents the number of trigonometric functions, i.e. the number of segments into which the first piecewise function is piecewise, where k0、k1、k2、k3、k4、…、knRepresenting the critical value of the piecewise function.
After fitting with a fitting kit, a1(t),a2(t),...,an(t);
Figure BDA0003371959170000092
Are all known functions.
Step S305: and performing Hilbert transform on the piecewise function to obtain a second piecewise function.
Step S306: and sampling values from the second piecewise function to obtain M discrete values so as to obtain a first ciphertext consisting of the M discrete values.
For example, the second segmentation function s (t) is also a function with t as an argument, and may take values from t being 1,2,3 …, M, respectively, to obtain M discrete values, where M discrete values are: s (1), S (2), S (3), …, S (M). Sequencing the M discrete values according to S (1), S (2), S (3), …, S (M) in sequence to obtain a first ciphertext, wherein the first ciphertext is: s (1) S (2) S (3) … S (M).
The embodiment of the application introduces the thought of Hilbert transform, divides a natural language signal into a real part branch and an imaginary part branch, and then processes the branch by using a complex processing principle, thereby realizing the reinforcement optimization of an SHA-1 algorithm and enhancing the safety of a block chain used in a service scene with higher safety level.
Step S307: and expanding the length complementary bits of the first ciphertext into 512 bits x Q to obtain a first message, wherein Q is any integer greater than or equal to 1.
The bit-filling expansion method provided by the embodiment of the present application has various types, but the embodiment of the present application provides, but is not limited to, the following three types.
The first implementation of step S307 includes steps a11 through a 14.
Step A11: and complementing one 1 at the tail end of the first ciphertext.
Illustratively, the first ciphertext is binary data.
For example, if the length of the first ciphertext is an integer multiple of 512, the padding expansion operation may not be required, and if the length of the first ciphertext is not an integer multiple of 512, the padding expansion operation may be required.
Step A12: and supplementing 0 after 1 of the complement bit of the first ciphertext until the length of the second message after the complement bit is 448 after the modulus of 512.
For example, if the length of the first ciphertext is 448 modulo 512, the remainder may not perform steps a11 through a 12. If the remainder of the length of the first ciphertext modulo 512 is not 448, steps a11 through a12 may be performed.
Step A13: and supplementing one 1 at the tail of the second message.
Step A14: and supplementing 63 0 s after 1 of the complementary bit of the second message to obtain the first message.
In order to make the implementation of the first step S307 more understandable to those skilled in the art, the following description is made.
Fig. 4a is a schematic diagram of the first ciphertext complement expansion according to the embodiment of the disclosure.
Assuming that the length of the first ciphertext is 600 bits, the remainder of the first ciphertext modulo 512 is 88, and a1 and 359 0 s are added after the first ciphertext to obtain the second message. After the second message is supplemented with one 1 and 63 0's, the first message is obtained.
The second implementation of step S307 includes steps a21 through a 23.
Step A21: and complementing one 1 at the tail end of the first ciphertext.
Illustratively, the first ciphertext is binary data.
For example, if the length of the first ciphertext is an integer multiple of 512, the padding expansion operation may not be required, and if the length of the first ciphertext is not an integer multiple of 512, the padding expansion operation may be required.
Step A22: and supplementing 0 after 1 of the complement bit of the first ciphertext until the length of the second message after the complement bit is 448 after the modulus of 512.
For example, if the length of the first ciphertext is 448 modulo 512, the remainder may not perform steps a21 through a 22. If the remainder of the length of the first ciphertext modulo 512 is not 448, steps a21 through a22 may be performed.
Step A23: and padding 64 bits of 1 at the tail of the second message to obtain the first message.
In order to make the implementation of the second step S307 more understood by those skilled in the art, the following description is made.
Fig. 4b is a schematic diagram of the first ciphertext complement expansion according to the embodiment of the disclosure.
Assuming that the length of the first ciphertext is 600 bits, the remainder of the first ciphertext modulo 512 is 88, and a1 and 359 0 s are added after the first ciphertext to obtain the second message. And supplementing 64 pieces of 1 after the second message to obtain the first message.
The third implementation of step S307 includes steps a31 through a 32.
Step A31: and complementing one 1 at the tail end of the first ciphertext.
Illustratively, the first ciphertext is binary data.
For example, if the length of the first ciphertext is an integer multiple of 512, the padding expansion operation may not be required, and if the length of the first ciphertext is not an integer multiple of 512, the padding expansion operation may be required.
Step A32: and supplementing 0 after 1 of the complement bit of the first ciphertext until the remainder is 0 after the length of the first message after the complement bit is modulo 512, so as to obtain the first message.
In order to make the implementation of the third step S307 more understandable to those skilled in the art, the following description is made.
Fig. 4c is a schematic diagram of the first ciphertext complement expansion according to the embodiment of the disclosure.
Assuming that the length of the first ciphertext is 600 bits, the remainder of the first ciphertext modulo 512 is 88, 1 is added after the first ciphertext, and 423 0 s are added to obtain the first message.
Step S308: and dividing the first message into Q data blocks, wherein the bit number of the data blocks is 512 bits.
Taking fig. 4a to 4c as an example, Q is 2.
For example, in this embodiment of the present application, the first packet is divided into Q data blocks, and one data block is obtained every time 512 bits of data are obtained from the head of the first packet.
Step S309: the initial value of G is set to 1.
Step S310: the following operations are performed for the G-th data block:
step S311: and dividing the data block into 16 target sub data blocks, wherein the number of bits of the target sub data blocks is 32.
Step S312: and performing operation on the 16 target sub data blocks to obtain 64 operation sub data blocks to obtain 80 sub data blocks, wherein the bit number of the operation sub data blocks is 32 bits, and the 80 sub data blocks comprise the 16 target sub data blocks and the 64 operation sub data blocks.
Step S313: obtaining preset 80 constants Kt(ii) a t takes the values 0, 1,2, …, 79.
In an alternative implementation, the 80 constants are different.
In an alternative implementation, the values of the 80 constants are as follows:
Ktfirst preset value (0)<=t<=19)
KtSecond predetermined value (20)<=t<=39)
KtThird preset value (40)<=t<=59)
KtFourth preset value (60)<=t<=79)。
In an optional implementation manner, the 80 constants corresponding to different data blocks may be different, for example, the corresponding relationship between the 16 target sub data blocks obtained in step S311 and the 80 constants may be preset. I.e., 80 constants that differ with the unused data blocks.
In an alternative implementation manner, the 80 constants corresponding to different input information may be different, for example, the corresponding relationship between the input information and the 80 constants may be preset. I.e., 80 constants, vary from input to input.
In an alternative implementation, the 80 constants corresponding to different data blocks may be the same.
In an alternative implementation, the first preset value is 0x5a827999, the second preset value is 0x6ED9EBA1, the third preset value is 0x8F1BBCDC, and the fourth preset value is 0xCA62C1D 6.
For example, 80 sub-data blocks sequentially include: 16 target sub-data blocks and 64 operation sub-data blocks.
Wherein, the sequence of the 16 target sub-data blocks is as follows: and sequencing according to the sequence of dividing the data block to obtain the target sub data block.
FIG. 5 is a schematic diagram showing the sequence of a data block divided into 16 target sub data blocks.
From the head of the data block, each time a target sub-data block is obtained by extracting 32 bits of data, a target sub-data block 1, a target sub-data block 2, a target sub-data block 3, a target sub-data block 4, …, and a target sub-data block 16 can be obtained in sequence. The sequence of the 16 target sub data blocks is: target sub data block 1, target sub data block 2, target sub data block 3, target sub data block 4, …, target sub data block 16.
In an alternative implementation manner, there are various implementation manners of step S312, and the present embodiment provides, but is not limited to, the following implementation manner, and the method includes step B11 to step B14.
Step B11: the initial value of R is set to 0.
Step B12: let t be R, perform the following operations:
step B13: wt=Mt(t is more than or equal to 0 and less than 16), wherein MtThe number of the target sub data blocks is t + 1; wt=S1(Wt-3XOR Wt-14 XOR Wt-16) (16 is less than or equal to t is less than or equal to 79); wherein, S1 indicates a shift of 1 bit to the left.
Step B14: let R ═ R +1, return to step B12 until R equals 80.
Wherein, the 80 sub-data blocks are sequentially: w0、W1、W2、W3,…,W79
In an alternative implementation, at least one of the 16 target sub-data blocks may be logically operated to obtain 64 operation sub-data blocks. The exclusive or operation XOR described above is not limited.
Step S314: obtaining buffer identification H0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4Is started.
In an alternative implementation, for the first data block, that is, when step S314 is performed for the first time, the preset identifier H of 16 sub data blocks and buffer may be used0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4In the corresponding relation of the initial values, the identifier H of the buffer area corresponding to the 16 target sub data blocks is searched0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4Is started.
I.e. H corresponding to different target sub-data blocksiThe initial values of the target sub data blocks are different, because the target sub data blocks are related to the input information, the randomness and the brute force cracking resistance of the algorithm are increased, the performance consumption of the algorithm is low, and the algorithm can be transplanted and realized on different platforms and hardware equipment so as to meet the requirements of various use scenes of a block chain in a financial business system.
In an alternative implementation, the buffer { Hi } is initialized to the following values:
H0=0x67452301
H1=0xEFCDAB89
H2=0x98BADCFE
H3=0x10325476
H4=0xC3D2E1F0
step S315: will H0Of (d), H1Of (d), H2Of the initial value of (1), H3Of (d), H4Respectively assigning the initial values to a first parameter, a second parameter, a third parameter, a fourth parameter and a fifth parameter.
Step S316: the initial value of P is set to 0.
Step S317: for t ═ P, the following calculation is performed:
TEMP=S5(H0)+ft(H1,H2,H3)+H4+Wt+Kt;H4=H3;H3=H2;H2=S30(H1);H1=H0;H0TEMP; wherein, WtFor the t +1 th sub-data block of the 80 sub-data blocks, ft(H1,H2,H3) Is a preset function; s. the5(H0) Means that H is0Left shift by 5; s30(H1) Means that H is1Shifted 30 to the left.
Exemplary, ft(H1,H2,H3) Is preset with H1,H2,H3As a function of the argument, e.g. a preset function ft(H1,H2,H3) The following were used:
ft(H1,H2,H3)=(H1 AND H2)or((NOT H1)AND H3)(0<=t<=19)
ft(H1,H2,H3)=H1 XOR H2 XOR H3(20<=t<=39)
ft(H1,H2,H3)=(H1 AND H2)or(H1 AND H3)or(H2 AND H3)(40<=t<=59)
ft(H1,H2,H3)=H1 XOR H2 XOR H3(60<=t<=79)。
in an alternative implementation, ft(H1,H2,H3) It may or may not be a piecewise function, and the above is only an example and is not for ft(H1,H2,H3) Resulting in a restriction.
Step S318: setting P to P +1, return to step S317 until P equals 80 to obtain the identification H of the buffer area0Value of (A), H1Value of (H)2Value of (A), H3Value of (A), H4The value of (c).
Step S319: let H0Final value of ═ H0Value of + first parameter, H1Final value of ═ H1Value of + second parameter, H2Final value of ═ H2Value of + third parameter, H3Final value of (H)3Value of + fourth parameter, H4Final value of ═ H4Value + fifth parameter.
Step S320: subjecting said H to0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (a), H4Respectively as the mark H of the buffer corresponding to the G +1 th data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4Of (4) is calculated.
I.e. the obtained identification H of the buffer when step S314 is executed for the second timeiIs the initial value of (a) obtained when step S319 is performed for the first time, H is obtainediThe final value of (c).
In the third execution of step S314, the obtained buffer identifier HiSecond time step S319 is executed, obtained HiThe final value of (c). And so on, will not be described again.
If the first packet is divided into a plurality of data blocks, multiple iterations may be required, and H obtained from a previous data block0Final value of (a), H1Final value of (1), H2Final value of (1), H3Final value of (1), H4Is the final value of H for the next data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4The initial value of (2) so that the finally obtained ciphertext is related to the number of iterations, and the ciphertext is more difficult to crack.
Step S321: set G +1 and return to step S310 until G is greater than Q.
Step S322: according to H0、H1、H2、H3、H4In the order of (A) and (B), is0Final value of (a), H1Final value of (a), H2Final value of (1), H3Final value of (1), H4Constitutes a 160-bit hash value.
It is understood that HiThe values of (a) are all 32 bits in length, so 5HiConstituting a 160-bit hash value.
Step S323: and obtaining a second ciphertext based on the 160-bit hash value.
In an alternative implementation, a 160-bit hash value is determined as the second ciphertext.
Step S324: storing the second ciphertext to a blockchain.
Illustratively, the ciphertext may be stored as a feature value of the input information to a corresponding block in the blockchain.
According to the ciphertext generating method based on Hilbert transform, after the input information is obtained, the input information is encrypted, and the encryption process is as follows: converting the input information into decimal ASCII codes to obtain a first character string consisting of the decimal ASCII codes; obtaining M coordinates from the first character string, wherein the abscissa of the coordinates is the position of the first character string, the ordinate of the coordinates is the character at the position, and the total number of characters contained in the first character string is M; using a fitting toolbox for the M coordinates, obtaining a first segmentation function:
Figure BDA0003371959170000151
{k0≤t<k1,i=1;k1≤t<k2,i=2;...;kn-1≤t<kni ═ n }; performing Hilbert transform on the piecewise function to obtain a second piecewise function; sampling values from a second piecewise function to obtain M discrete values so as to obtain a first ciphertext consisting of the M discrete values; and then, SHA-1 algorithm encryption is carried out on the first ciphertext, and even if an attacker decrypts the first ciphertext through SHA-1, the first ciphertext is still the encrypted ciphertext, so that the input information cannot be obtained through decryption, and the safety is improved. And if the first message is divided into a plurality of data blocks in the application, the identifier H of the buffer area corresponding to the next data block is obtained in the calculation process of the next data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4Is the initial value of H obtained for the last data block0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (1), H4The obtained second ciphertext is related to the process of encrypting the input information to obtain the first ciphertext and the number of the divided data blocks of the first message, if brute force cracking is needed, the number of the divided data blocks of the first message needs to be tried to be cracked, and the process of encrypting the input information to obtain the first ciphertext needs to be cracked.
Because the SHA-1 algorithm is used for a long time, an attacker accumulates a considerable number of dictionary libraries, and in order to further enhance the security of the attacker and improve the anti-dictionary attack cracking capability so as to adapt to the increasingly deteriorated security situation, the secure hash algorithm 1 needs to be further reinforced. After the secure hash algorithm 1 is further reinforced by the embodiment of the application, even if the hash value of the input information is leaked, the improved algorithm is invalid through the current dictionary base, the hash value cannot be reversely cracked, and the security of the block chain service is further enhanced.
In an alternative implementation, in order to further improve the security of the input information, the present application further provides a method, which is a process of reassigning 80 constants, and the process includes the following steps C11 to C16.
Step C11: the 80 constants KtRespectively converted into decimal number K'tTo give 80K't
Step C12: based on the 80K'tObtaining 80 coordinates (t, K't)。
Step C13: for the 80 coordinates (t, K't) Using a fitting toolbox, a third segmentation function is obtained:
Figure BDA0003371959170000161
{L0≤t<L1,i=1;L1≤t<L2,i=2;...;Lm-1≤t<Lm,i=m}。
illustratively, the fitting kit may be a cftool kit.
It will be appreciated that after fitting by the fitting kit, a third piecewise function of a finite number of trigonometric functions may be obtained, where m represents the number of trigonometric functions, i.e. the number of segments into which the third piecewise function is piecewise, where L0、L1、L2、L3、L4、…、LmRepresenting the critical value of the piecewise function.
After fitting with a fitting kit, b1(t),b2(t),...,bm(t);
Figure BDA0003371959170000162
Are all known functions.
Step C14: and performing Hilbert transform on the third segmentation function to obtain a fourth segmentation function.
Step C15: taking 80 discrete values from the fourth piecewise function sample.
Step C16: and sorting the 80 discrete values from small to large according to the abscissa, and sequentially assigning the 80 constants.
In summary, 80 constants are reassigned, and the formula TEMP in step S317 is executed as S5(H0)+ft(H1,H2,H3)+H4+Wt+KtWhen, KtAre the constants that are reassigned. H derived based on 80 reassigned constants0Value of (A), H1Value of (A), H2Value of (A), H3Value of (A), H4And H obtained based on 80 constants set in advance0Value of (A), H1Value of (A), H2Value of (A), H3Value of (A), H4The value of (c) is different. Therefore, the obtained second ciphertext is also related to the 80 re-assigned constants, and if the second ciphertext needs to be cracked, the 80 re-assigned constants need to be cracked, so that compared with the prior art, brute force cracking is more difficult, and the safety of input information is improved.
The method comprises the steps of encrypting input information for multiple times, and obtaining a first ciphertext if encrypting for the first time; the second encryption is carried out, and 80 constants are reassigned; encrypting for the third time, if the first message is divided into a plurality of data blocks, in the process of calculating the next data block, the identifier H of the buffer area corresponding to the next data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4Is the initial value of H obtained for the last data block0Final value of (1), H1Final value of (1), H2Final value of (a), H3Final value of (1), H4Such that the second ciphertext is related to the number of iterations. But the final second ciphertext is still 160 bits in length and is unchanged.
By adopting the ciphertext generation method based on Hilbert transform, the safety of the characteristic value of the input information of the block chain is improved, an attacker cannot use the conventional SHA-1 dictionary base to reversely decrypt the characteristic value, and the possibility of brute force cracking is avoided.
The method is described in detail in the embodiments disclosed in the present application, and the method of the present application can be implemented by various types of apparatuses, so that an apparatus is also disclosed in the present application, and the following detailed description is given of specific embodiments.
As shown in fig. 6, a structure diagram of a ciphertext generating apparatus based on hilbert transform according to an embodiment of the present application, the apparatus includes: a first obtaining module 601, a first converting module 602, a second obtaining module 603, a third obtaining module 604, a second converting module 605, a fourth obtaining module 606, a bit-padding expanding module 607, a first dividing module 608, a first setting module 609, a second dividing module 610, an operation module 611, a fifth obtaining module 612, a sixth obtaining module 613, a first assigning module 614, a second assigning module 615, a calculating module 616, a first triggering module 617, a third assigning module 618, a fourth assigning module 619, a second triggering module 620, a seventh obtaining module 621, an eighth obtaining module 622, and a storage module 623, wherein:
a first obtaining module 601, configured to obtain input information to be stored in a block chain;
a first conversion module 602, configured to convert the input information into decimal ASCII codes to obtain a first character string composed of the decimal ASCII codes;
a second obtaining module 603, configured to obtain M coordinates from the first character string, where an abscissa of the coordinates is a position of the first character string, an ordinate of the coordinates is a character at the position, and a total number of characters included in the first character string is M;
a third obtaining module 604, configured to obtain, using a fitting toolbox for the M coordinates, a first segmentation function:
Figure BDA0003371959170000181
{k0≤t<k1,i=1;k1≤t<k2,i=2;...;kn-1≤t<kn,i=n};
a second conversion module 605, configured to perform hilbert transform on the piecewise function to obtain a second piecewise function;
a fourth obtaining module 606, configured to sample values from the second piecewise function to obtain M discrete values, so as to obtain a first ciphertext composed of the M discrete values;
a bit complement expansion module 607, configured to expand the length bit complement of the first ciphertext into 512 bits × Q to obtain a first packet, where Q is any integer greater than or equal to 1;
a first dividing module 608, configured to divide the first packet into Q data blocks, where the number of bits of each data block is 512 bits;
a first setting module 609, configured to set an initial value of G to 1;
a second partitioning module 610, configured to perform the following operations for the G-th data block:
dividing the data block into 16 target sub data blocks, wherein the number of bits of the target sub data blocks is 32;
an operation module 611, configured to perform an operation on the 16 target sub data blocks to obtain 64 operation sub data blocks, so as to obtain 80 sub data blocks, where the bit number of the operation sub data blocks is 32 bits, and the 80 sub data blocks include 16 target sub data blocks and 64 operation sub data blocks;
a fifth obtaining module 612, configured to obtain preset 80 constants Kt(ii) a t takes the values of 0, 1,2, … and 79;
a sixth obtaining module 613, configured to obtain an identifier H of the buffer0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4The initial value of (1);
a first assignment module 614 for assigning H0Of (d), H1Of (d), H2Of the initial value of (1), H3Of (d), H4Respectively assigning the initial values to a first parameter, a second parameter, a third parameter, a fourth parameter and a fifth parameter;
a second assignment module 615, configured to set an initial value of P to 0;
a calculation module 616 configured to perform the following calculation for t ═ P:
TEMP=S5(H0)+ft(H1,H2,H3)+H4+Wt+Kt;H4=H3;H3=H2;H2=S30(H1);H1=H0;H0TEMP; wherein, WtFor the t +1 th sub-data block of the 80 sub-data blocks, ft(H1,H2,H3) Is a preset function; s5(H0) Means that H is0Left shift by 5; s30(H1) Means that H is1Left shift by 30;
a first triggering module 617 for setting P +1, and returning to the calculating module until P equals 80 to obtain the identifier H of the buffer area0Value of (A), H1Value of (A), H2Value of (A), H3Value of (A), H4A value of (d);
a third assigning module 618 for ordering H0Final value of ═ H0Value of + first parameter, H1Final value of ═ H1Value of + second parameter, H2Final value of ═ H2Value of + third parameter, H3Final value of ═ H3Value of + fourth parameter, H4Final value of ═ H4The value of + the fifth parameter;
a fourth assigning module 619 for assigning the H0Final value of (a), H1Final value of (1), H2Final value of (1), H3Final value of (1), H4Respectively as the mark H of the buffer corresponding to the G +1 th data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4An initial value of (1);
a second triggering module 620, configured to set G +1, and return to the second dividing module until G is greater than Q;
a seventh obtaining module 621 configured to obtain H0、H1、H2、H3、H4In the order of (1) to obtain H0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (1), H4A 160-bit hash value;
an eighth obtaining module 622, configured to obtain a ciphertext based on the 160-bit hash value;
and a storage module 623, configured to store the ciphertext to the block chain.
In an optional implementation manner, the method further includes:
a third conversion module for converting the 80 constants KtRespectively converted into decimal number K'tTo give 80K't
A ninth obtaining module for obtaining K 'based on the 80'tObtaining 80 coordinates (t, K't);
A tenth acquiring module for acquiring the 80 coordinates (t, K't) Using a fitting toolbox, a third segmentation function is obtained:
Figure BDA0003371959170000201
{L0≤t<L1,i=1;L1≤t<L2,i=2;...;Lm-1≤t<Lm,i=m};
the fourth conversion module is used for performing Hilbert transform on the third segmentation function to obtain a fourth segmentation function;
a sampling module for sampling 80 discrete values from said fourth piecewise function;
and the fifth assignment module is used for sequencing the 80 discrete values from small to large according to the abscissa and sequentially assigning the 80 constants.
In an optional implementation manner, the bit complement expansion module includes:
a first complementary unit for complementing a bit by one 1 at the end of the first ciphertext;
a second bit complement unit, configured to complement 0 after 1 of the first ciphertext bit complement until a remainder of a length of the second ciphertext after bit complement modulo 512 is 448;
a third bit complementing unit, configured to complement a bit 1 at the end of the second packet;
a fourth bit complement unit, configured to complement 63 0 s after 1 of the bit complement of the second packet, to obtain the first packet.
In an alternative implementation, the first preset value is 0x5a827999, the second preset value is 0x6ED9EBA1, the third preset value is 0x8F1BBCDC, and the fourth preset value is 0xCA62C1D 6.
In an alternative implementation, the preset function ft(H1,H2,H3) The following:
ft(H1,H2,H3)=(H1 AND H2)or((NOT H1)AND H3)(0<=t<=19)
ft(H1,H2,H3)=H1 XOR H2 XOR H3(20<=t<=39)
ft(H1,H2,H3)=(H1 AND H2)or(H1 AND H3)or(H2 AND H3)(40<=t<=59)
ft(H1,H2,H3)=H1 XOR H2 XOR H3(60<=t<=79)。
with regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 7 is a block diagram illustrating an apparatus for a server in accordance with an example embodiment.
Servers include, but are not limited to: a processor 71, a memory 72, a network interface 73, an I/O controller 74, and a communication bus 75.
It should be noted that the structure of the server shown in fig. 7 does not constitute a limitation of the server, and the server may include more or less components than those shown in fig. 7, or combine some components, or arrange different components, as will be understood by those skilled in the art.
The following describes each component of the server in detail with reference to fig. 7:
the processor 71 is a control center of the server, connects various parts of the entire server using various interfaces and lines, and performs various functions of the server and processes data by running or executing software programs and/or modules stored in the memory 72 and calling data stored in the memory 72, thereby performing overall monitoring of the server. Processor 71 may include one or more processing units; illustratively, the processor 71 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 71.
Processor 71 may be a Central Processing Unit (CPU), or an application Specific Integrated circuit (asic), or one or more Integrated circuits configured to implement embodiments of the present invention, etc.;
the Memory 72 may include Memory, such as a Random-Access Memory (RAM) 721 and a Read-Only Memory (ROM) 722, and may also include a mass storage device 723, such as at least 1 disk storage. Of course, the server may also include hardware needed for other services.
The memory 72 is used for storing the executable instructions of the processor 71. The processor 71 has a function of a ciphertext generating method based on the hilbert transform.
A wired or wireless network interface 73 is configured to connect the server to a network.
The processor 71, the memory 72, the network interface 73, and the I/O controller 74 may be connected to each other by a communication bus 75, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc.
In an exemplary embodiment, the server may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described hilbert transform-based ciphertext generation method.
In an exemplary embodiment, the disclosed embodiments provide a storage medium comprising instructions, such as a memory 72 comprising instructions, executable by a processor 71 of a server to perform the above-described method. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical hilbert transform-based ciphertext generation apparatus, and the like.
In an exemplary embodiment, a computer-readable storage medium is also provided, which is directly loadable into an internal memory of a computer, such as the memory 72 described above, and contains software codes, and which, when loaded and executed by the computer, is able to implement the steps shown in any embodiment of the above-mentioned hilbert transform-based ciphertext generation method.
In an exemplary embodiment, a computer program product is further provided, which is directly loadable into an internal memory of a computer, for example, a memory included in the server, and contains software codes, and which, when loaded and executed by the computer, is capable of implementing the steps shown in any embodiment of the above-mentioned ciphertext generation method based on hilbert transform.
The ciphertext generating method, the server, the medium, and the apparatus based on the hilbert transform provided by the present invention may be used in the field of block chains or in the field of finance. The above description is merely an example, and does not limit the application fields of the ciphertext generation method, the server, the medium, and the apparatus based on the hilbert transform provided by the present invention.
It should be noted that the features described in the embodiments in the present specification may be replaced with or combined with each other. For the device or system type embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A ciphertext generation method based on Hilbert transform, comprising:
acquiring input information to be stored to a block chain;
converting the input information into decimal ASCII codes to obtain a first character string consisting of the decimal ASCII codes;
obtaining M coordinates from the first character string, wherein the abscissa of the coordinates is the position of the first character string, the ordinate of the coordinates is the character at the position, and the total number of characters contained in the first character string is M;
using a fitting toolbox for the M coordinates, obtaining a first segmentation function:
Figure FDA0003371959160000011
performing Hilbert transform on the piecewise function to obtain a second piecewise function;
sampling values from a second piecewise function to obtain M discrete values so as to obtain a first ciphertext consisting of the M discrete values;
expanding the length complementary bit of the first ciphertext into 512 bits x Q to obtain a first message, wherein Q is any integer greater than or equal to 1;
dividing the first message into Q data blocks, wherein the number of bits of the data blocks is 512 bits;
setting the initial value of G to be 1;
the following operations are performed for the G-th data block:
dividing the data block into 16 target sub data blocks, wherein the number of bits of each target sub data block is 32;
performing operation on the 16 target sub data blocks to obtain 64 operation sub data blocks so as to obtain 80 sub data blocks, wherein the bit number of the operation sub data blocks is 32 bits, and the 80 sub data blocks comprise the 16 target sub data blocks and the 64 operation sub data blocks;
obtaining preset 80 constants Kt(ii) a t takes the values of 0, 1,2, … and 79;
obtaining an identity of a buffer H0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4An initial value of (1);
h is to be0Of (d), H1Of (d), H2Of (d), H3Of (d), H4Respectively assigning the initial values to a first parameter, a second parameter, a third parameter, a fourth parameter and a fifth parameter;
setting the initial value of P to be 0;
for t ═ P, the following calculation is performed:
TEMP=S5(H0)+ft(H1,H2,H3)+H4+Wt+Kt;H4=H3;H3=H2;H2=S30(H1);H1=H0;H0TEMP; wherein, WtFor the t +1 sub-data block of the 80 sub-data blocks, ft(H1,H2,H3) Is a preset function; s5(H0) Means that H is0Left shift by 5; s30(H1) Means that H is1Left shift by 30;
setting P +1, returning to the step for t P, the following calculation is performed until P equals 80 to obtain the identification H of the buffer area0Value of (A), H1Value of (A), H2Value of (H)3Value of (A), H4A value of (d);
let H0Final value of ═ H0Value of + first parameter, H1Final value of ═ H1Value of + second parameter, H2Final value of ═ H2Value of + third parameter, H3Final value of ═ H3Value of + fourth parameter, H4Final value of ═ H4The value of + the fifth parameter;
subjecting said H to0Final value of (a), H1Final value of (1), H2Final value of (a), H3Final value of、H4Respectively as the mark H of the buffer corresponding to the G +1 th data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4The initial value of (1);
setting G to G +1, and returning to the step to execute the following operations on the G-th data block until G is larger than Q;
according to H0、H1、H2、H3、H4In the order of (1) to obtain H0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (a), H4160 bit hash value;
obtaining a second ciphertext based on the 160-bit hash value;
storing the second ciphertext to a blockchain.
2. The ciphertext generation method based on hilbert transform as claimed in claim 1, wherein the obtaining step comprises obtaining preset 80 constants KtThen, the method further comprises the following steps:
the 80 constants KtRespectively converted into decimal number K'tTo obtain 80K't
Based on the 80K'tObtaining 80 coordinates (t, K't);
For the 80 coordinates (t, K't) Using a fitting toolbox, a third segmentation function is obtained:
Figure FDA0003371959160000021
performing Hilbert transform on the third segmentation function to obtain a fourth segmentation function;
sampling 80 discrete values from said fourth piecewise function;
and sorting the 80 discrete values from small to large according to the abscissa, and sequentially assigning the 80 constants.
3. The method of claim 1, wherein the step of expanding the complementary length bits of the first ciphertext to 512 bits x Q to obtain the first message comprises:
padding one 1 at the end of the first ciphertext;
supplementing 0 after 1 of the complement bit of the first ciphertext until the length of the second message after the complement bit is 448 after modulus of 512;
padding one 1 at the tail of the second message;
and supplementing 63 0 s after 1 of the complementary bit of the second message to obtain the first message.
4. The Hilbert transform-based ciphertext generating method according to any one of claims 1 to 3, wherein the step of performing an operation on the 16 target sub-data blocks to obtain 64 operation sub-data blocks comprises:
setting the initial value of R to be 0;
let t equal R, perform the following operations:
Wt=Mt(t is more than or equal to 0 and less than 16), wherein MtThe target subdata block is the t +1 th subdata block;
Wt=S1(Wt-3 XOR Wt-14 XOR Wt-16) (16 is less than or equal to t is less than or equal to 79); wherein, S1 indicates a shift of 1 bit to the left;
let R ═ R +1, return to step let t ═ R, perform the following operations until R equals 80.
5. The Hilbert transform-based ciphertext generation method according to any of claims 1 to 3, wherein the preset function ft(H1,H2,H3) The following were used:
ft(H1,H2,H3)=(H1 AND H2)or((NOT H1)AND H3)(0<=t<=19)
ft(H1,H2,H3)=H1 XOR H2 XOR H3(20<=t<=39)
ft(H1,H2,H3)=(H1 AND H2)or(H1 AND H3)or(H2 AND H3)(40<=t<=59)
ft(H1,H2,H3)=H1 XOR H2 XOR H3(60<=t<=79)。
6. a ciphertext generation apparatus based on a hilbert transform, comprising:
the first acquisition module is used for acquiring input information to be stored to the block chain;
a first conversion module for converting the input information into decimal ASCII codes to obtain a first character string composed of the decimal ASCII codes;
a second obtaining module, configured to obtain M coordinates from the first character string, where an abscissa of the coordinate is a position in the first character string, an ordinate of the coordinate is a character at the position, and a total number of characters included in the first character string is M;
a third obtaining module, configured to obtain a first segmentation function by using a fitting toolbox for the M coordinates:
Figure FDA0003371959160000041
the second conversion module is used for performing Hilbert transform on the piecewise function to obtain a second piecewise function;
the fourth obtaining module is used for sampling values from the second piecewise function to obtain M discrete values so as to obtain a first ciphertext formed by the M discrete values;
a bit complement expansion module, configured to expand the length bit complement of the first ciphertext into 512 bits × Q to obtain a first packet, where Q is any integer greater than or equal to 1;
the first dividing module is used for dividing the first message into Q data blocks, and the bit number of each data block is 512 bits;
the first setting module is used for setting the initial value of G to be 1;
the following operations are performed for the G-th data block:
the second dividing module is used for dividing the data block into 16 target sub data blocks, and the number of bits of each target sub data block is 32;
an operation module, configured to perform an operation on the 16 target sub data blocks to obtain 64 operation sub data blocks, so as to obtain 80 sub data blocks, where a bit number of the operation sub data block is 32 bits, and the 80 sub data blocks include the 16 target sub data blocks and the 64 operation sub data blocks;
a fifth obtaining module, configured to obtain preset 80 constants Kt(ii) a t takes the values of 0, 1,2, … and 79;
a sixth obtaining module, configured to obtain an identifier H of the buffer0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4An initial value of (1);
a first assignment module for assigning H0Of (d), H1Of (d), H2Of (d), H3Of (d), H4Respectively assigning the initial values to a first parameter, a second parameter, a third parameter, a fourth parameter and a fifth parameter;
the second assignment module is used for setting the initial value of P to be 0;
a calculation module for performing the following calculation for t ═ P:
TEMP=S5(H0)+ft(H1,H2,H3)+H4+Wt+Kt;H4=H3;H3=H2;H2=S30(H1);H1=H0;H0TEMP; wherein, WtFor the t +1 th sub-data block of the 80 sub-data blocks, ft(H1,H2,H3) Is a preset function; s5(H0) Means that H is0Left shift by 5; s30(H1) Means that H is1Left shift by 30;
a first trigger module, configured to set P +1, and return to the calculation module until P equals 80, so as to obtain an identifier H of the buffer area0Value of (A), H1Value of (A), H2Value of (A), H3Value of (H)4A value of (d);
a third assignment module for ordering H0Final value of ═ H0Value of + first parameter, H1Final value of ═ H1Value of + second parameter, H2Final value of ═ H2Value of + third parameter, H3Final value of ═ H3Value of + fourth parameter, H4Final value of (H)4The value of + the fifth parameter;
a fourth assignment module to assign H to the data0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (1), H4Respectively as the mark H of the buffer corresponding to the G +1 th data block0Initial value of (1), H1Initial value of (1), H2Initial value of (1), H3Initial value of (1), H4An initial value of (1);
the second trigger module is used for setting G +1 and returning to the second dividing module until G is larger than Q;
a seventh obtaining module for obtaining according to H0、H1、H2、H3、H4In the order of (1) to obtain H0Final value of (1), H1Final value of (1), H2Final value of (1), H3Final value of (1), H4A 160-bit hash value;
an eighth obtaining module, configured to obtain a ciphertext based on the 160-bit hash value;
and the storage module is used for storing the ciphertext to the block chain.
7. The ciphertext generation apparatus based on the hilbert transform, according to claim 1, further comprising:
a third conversion module for converting the 80 constants KtRespectively converted into decimal number K'tTo give 80K't
A ninth obtaining module for obtaining K 'based on the 80'tObtaining 80 coordinates (t, K't);
A tenth acquiring module for acquiring the 80 coordinates (t, K't) Using a fitting toolbox, a third segmentation function is obtained:
Figure FDA0003371959160000051
the fourth conversion module is used for performing Hilbert transform on the third segmentation function to obtain a fourth segmentation function;
a sampling module for sampling 80 discrete values from said fourth piecewise function;
and the fifth assignment module is used for sorting the 80 discrete values from small to large according to the abscissa and sequentially assigning the 80 constants.
8. A server, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the Hilbert transform based ciphertext generation method of any one of claims 1 to 5.
9. A computer-readable storage medium in which instructions, when executed by a processor of a server, enable the server to perform the hilbert transform-based ciphertext generation method of any one of claims 1 to 5.
10. A computer program product directly loadable into the internal memory of a computer, said memory being the memory comprised by the server of claim 8 and containing software code, said computer program being adapted to enable, when loaded and executed by a computer, the method for generating a ciphertext based on a hilbert transform as claimed in any one of claims 1 to 5.
CN202111404967.2A 2021-11-24 2021-11-24 Hilbert transform-based ciphertext generation method, server, medium, and apparatus Pending CN114091070A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111404967.2A CN114091070A (en) 2021-11-24 2021-11-24 Hilbert transform-based ciphertext generation method, server, medium, and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111404967.2A CN114091070A (en) 2021-11-24 2021-11-24 Hilbert transform-based ciphertext generation method, server, medium, and apparatus

Publications (1)

Publication Number Publication Date
CN114091070A true CN114091070A (en) 2022-02-25

Family

ID=80304074

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111404967.2A Pending CN114091070A (en) 2021-11-24 2021-11-24 Hilbert transform-based ciphertext generation method, server, medium, and apparatus

Country Status (1)

Country Link
CN (1) CN114091070A (en)

Similar Documents

Publication Publication Date Title
Teh et al. Parallel chaotic hash function based on the shuffle-exchange network
US5651069A (en) Software-efficient message authentication
WO2019114122A1 (en) Encryption method for login information, device, electronic device, and medium
CN107612683B (en) Encryption and decryption method, device, system, equipment and storage medium
KR20150102827A (en) USER DEVICE PERFORMING PASSWROD BASED AUTHENTICATION AND PASSWORD Registration AND AUTHENTICATION METHOD THEREOF
CN112287377A (en) Model training method based on federal learning, computer equipment and storage medium
CN115051798A (en) Random number generation method and device, electronic equipment and storage medium
CN113746620A (en) Homomorphic encryption method, apparatus, medium, and computer program product
CN113098675B (en) Binary data encryption system and method based on polynomial complete homomorphism
Akhavan et al. Hash function based on piecewise nonlinear chaotic map
CN113051598B (en) File access control method, file encryption method and computing device
CN112235104B (en) Data encryption transmission method, system, terminal and storage medium
CN111368317B (en) Computer data encryption system and method
CN113067816A (en) Data encryption method and device
Huang et al. Security analysis of image encryption based on twodimensional chaotic maps and improved algorithm
CN107947944B (en) Incremental signature method based on lattice
CN114091070A (en) Hilbert transform-based ciphertext generation method, server, medium, and apparatus
CN114124357B (en) Ciphertext generation method, server, medium and device based on Fourier series
CN114826560A (en) Method and system for realizing lightweight block cipher CREF
CN114124356B (en) Ciphertext generation method, server, medium and device applied to blockchain
CN114374505A (en) Ciphertext generating method, device, server, medium and product
CN113901437A (en) Password generation method and device, computer equipment and storage medium
CN114091117A (en) Data storage method, server, medium, and apparatus
CN114124358B (en) Ciphertext generating method, ciphertext generating device, server and medium
CN115114279A (en) Substitution table generation method, data encryption and decryption method and device, medium and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination