CN114124358B - Ciphertext generating method, ciphertext generating device, server and medium - Google Patents

Ciphertext generating method, ciphertext generating device, server and medium Download PDF

Info

Publication number
CN114124358B
CN114124358B CN202111404982.7A CN202111404982A CN114124358B CN 114124358 B CN114124358 B CN 114124358B CN 202111404982 A CN202111404982 A CN 202111404982A CN 114124358 B CN114124358 B CN 114124358B
Authority
CN
China
Prior art keywords
ciphertext
value
target
initial value
input information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111404982.7A
Other languages
Chinese (zh)
Other versions
CN114124358A (en
Inventor
王公桃
叶雪峰
李理
孙波
张峤
吕鹏
杨超群
张梦雅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 CN202111404982.7A priority Critical patent/CN114124358B/en
Publication of CN114124358A publication Critical patent/CN114124358A/en
Application granted granted Critical
Publication of CN114124358B publication Critical patent/CN114124358B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Power Engineering (AREA)
  • Storage Device Security (AREA)

Abstract

The application discloses a ciphertext generating method, a ciphertext generating device, a server and a ciphertext generating medium, which can be applied to the field of blockchain or the field of finance. If the input information to be stored into the blockchain is encrypted only by using SHA-1, and the possibility of being cracked is greater than or equal to a preset threshold value, searching a target high-risk message character contained in the input information and a target position of the target high-risk message character in the input information based on a preset high-risk message character; calculating to obtain a target character based on the target dangerous message character and the target position; replacing a target high-risk character at a target position in the input information with a target character to obtain a first ciphertext; encrypting the first ciphertext by a secure hash algorithm 1 to obtain a second ciphertext; the second ciphertext is stored to the blockchain. Because the target high-risk message characters which are easy to crack in the input information are replaced, the first ciphertext does not comprise the target high-risk message characters which are easy to crack, so that the safety of the ciphertext is improved.

Description

Ciphertext generating method, ciphertext generating device, server and medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a ciphertext generating method, a ciphertext generating device, a ciphertext generating server, and a ciphertext generating medium.
Background
SHA-1 (Secure Hash Algorithm, secure hash algorithm 1) is a function that generates 160-bit ciphertext, which is widely used in the prior art, but with the continued development of computer computing power, security personnel have successfully broken the SHA-1 algorithm.
Therefore, how to strengthen ciphertext enhancement using SHA-1 encryption is a necessary requirement for technical development.
Disclosure of Invention
In view of this, the present application provides a ciphertext generating method, apparatus, server, and medium.
In order to achieve the above purpose, the present application provides the following technical solutions:
according to a first aspect of an embodiment of the present disclosure, there is provided a ciphertext generating method, including:
acquiring input information to be stored in a block chain;
inputting the input information into a pre-constructed artificial intelligent model, and obtaining the probability of being cracked after the input information is encrypted by a secure hash algorithm 1 through the artificial intelligent model; the artificial intelligent model is obtained by taking sample input information as input, taking the probability of ciphertext encrypted by the safe hash algorithm 1 of the sample input information being cracked as a training target, and training a machine learning model;
if the probability is greater than or equal to a preset threshold value, searching a target high-risk message character contained in the input information and a target position of the target high-risk message character in the input information based on a preset high-risk message character;
Calculating to obtain a target character based on the target high-risk message character and the target position;
replacing the target high-risk character at the target position in the input information with the target character to obtain a first ciphertext;
encrypting the first ciphertext by a secure hash algorithm 1 to obtain a second ciphertext;
and storing the second ciphertext to the blockchain.
According to a second aspect of the embodiments of the present disclosure, there is provided a ciphertext generating apparatus, comprising:
the first acquisition module is used for acquiring input information to be stored in the blockchain;
the second acquisition module is used for inputting the input information into a pre-constructed artificial intelligent model, and obtaining the probability of being cracked after the input information is encrypted by the secure hash algorithm 1 through the artificial intelligent model; the artificial intelligent model is obtained by taking sample input information as input, taking the probability of ciphertext encrypted by the safe hash algorithm 1 of the sample input information being cracked as a training target, and training a machine learning model;
the searching module is used for searching target high-risk message characters contained in the input information and target positions of the target high-risk message characters in the input information based on preset high-risk message characters if the probability is larger than or equal to a preset threshold value;
The calculation module is used for calculating and obtaining a target character based on the target high-risk message character and the target position;
the replacing module is used for replacing the target high-risk character at the target position in the input information with the target character so as to obtain a first ciphertext;
the encryption module is used for encrypting the first ciphertext through a secure hash algorithm 1 so as to obtain a second ciphertext;
and the storage module is used for storing the second ciphertext to the block chain.
According to a third aspect of embodiments of the present disclosure, there is provided 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 ciphertext generating method of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium, which when executed by a processor of a server, causes the server to perform the ciphertext generating method of 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 being in a memory comprised by the server as described in the third aspect and containing software code, the computer program being capable of implementing the ciphertext generating method as described in the first aspect after being loaded and executed via the computer.
According to the technical scheme, if the input information to be stored in the blockchain is encrypted only by using SHA-1, and the probability of being cracked is greater than or equal to a preset threshold value, namely higher, the target high-risk message characters contained in the input information and the target positions of the target high-risk message characters in the input information can be searched based on the preset high-risk message characters; calculating to obtain a target character based on the target dangerous message character and the target position; replacing a target high-risk character at a target position in the input information with a target character to obtain a first ciphertext; so that the characters which are easy to crack in the input information are replaced, and the first ciphertext is encrypted by a secure hash algorithm 1 to obtain the second ciphertext; and storing the second ciphertext to the blockchain. Because the target high-risk message characters which are easy to crack in the input information are replaced, the first ciphertext does not comprise the target high-risk message characters which are easy to crack, namely, the second ciphertext obtained by performing the secure hash algorithm 1 on the first ciphertext cannot be cracked even if the known dictionary library of the SHA-1 is used, so that the security of the ciphertext is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings may be obtained according to the provided drawings without inventive effort to a person skilled in the art.
FIG. 1 is a block chain device block diagram according to an embodiment of the present application;
FIG. 2 is a block chain block diagram provided in an embodiment of the present application;
fig. 3 is a flowchart of a ciphertext generating method according to an embodiment of the present application;
FIGS. 4 a-4 c are schematic diagrams illustrating bit-filling expansion of input information according to embodiments of the present application;
FIG. 5 is a schematic diagram of an ordering of data blocks divided into 16 target sub-data blocks;
fig. 6 is a block diagram of a ciphertext generating apparatus according to an embodiment of the present application;
fig. 7 is a block diagram illustrating an apparatus for a server according to an exemplary embodiment.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The embodiment of the application provides a ciphertext generating method, a ciphertext generating device, a server and a ciphertext generating medium, and before introducing the technical scheme provided by the embodiment of the application, the application environment related to the embodiment of the application is described.
As shown in fig. 1, a block chain device according to an embodiment of the present application is shown in a block chain structure.
The blockchain device includes a plurality of nodes 11, which may be electronic devices or servers.
By way of example, the electronic device may be any electronic product that can interact with a user by one or more of a keyboard, a touchpad, a touch screen, a remote control, a voice interaction, a handwriting device, etc., such as a mobile phone, a notebook computer, a tablet computer, a palm top computer, a personal computer, a wearable device, a smart television, a PAD, etc.
The server may be a server, a server cluster formed by a plurality of servers, or a cloud computing server center. The server may include a processor, memory, network interfaces, and the like.
The blockchain device comprises a plurality of nodes which respectively store the same blockchain.
For any one of the plurality of nodes, the node stores node identifications of other nodes in the blockchain device for subsequent broadcasting of the generated blocks to other nodes in the blockchain device based on the other node identifications.
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, a blockchain is made up 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 time stamp 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 father 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 father 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 are associated with the block data stored in the father 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 positioned receives input information, the input information needs to be calculated by an SHA-1 algorithm, and the obtained 160-bit ciphertext is used as a characteristic value of the input information and is stored in a block header. After the block main body and the block head are obtained, the current block is obtained, then the node where the block chain is located sends the newly generated block to other nodes according to the node identification of other nodes, the other nodes verify the newly generated block, and the newly generated block is added into the block chain stored in the block chain after the verification is completed.
With the continuous development of the computing power of the computer 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 is possibly cracked by violence. 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 broken by violence, but the SHA-2 algorithm generates 256-bit ciphertext, that is, the length of the ciphertext is different from that of the 160-bit ciphertext generated by the SHA-1 algorithm, the improvement will affect the interface and the message format, increase the transformation cost and have great difficulty.
The embodiment of the application provides a ciphertext generating method, which ensures that the length of a ciphertext obtained by using an SHA-1 algorithm is 160 bits, so that an interface and a message format are not required to be improved, and the transformation cost is reduced.
The ciphertext generating method provided by the embodiment of the application can be applied to any application scene using SHA-1, for example, a calculation scene of characteristic values of transaction data of a bank. In the case that the input information is different in different application scenes, such as in the calculation scene of the characteristic value of the transaction data of the bank, the input information is the transaction data.
The ciphertext generating method provided in the embodiment of the present application is described below.
As shown in fig. 3, a flowchart of a ciphertext generating method according to an embodiment of the present application is provided, and the method includes the following steps S301 to S307.
Step S301: input information to be stored to the blockchain is obtained.
Illustratively, the input information may be transaction data. Such as transfer transaction data.
Illustratively, the input information is ASCII code data.
Step S302: inputting the input information into a pre-constructed artificial intelligent model, and obtaining the probability of being cracked after the input information is encrypted by a secure hash algorithm 1 through the artificial intelligent model; the artificial intelligent model is obtained by taking sample input information as input, taking the probability of ciphertext encrypted by the secure hash algorithm 1 of the sample input information being cracked as a training target, and training a machine learning model.
It can be understood that, for the sample input information, the probability of cracking the ciphertext obtained by encrypting the sample input information by SHA-1 can be determined based on the collision password library of SHA-1, so that the sample input information library can be utilized to train the machine learning model.
The training process of the machine learning model involves at least one of artificial neural network, confidence network, reinforcement learning, transfer learning, induction learning, teaching learning and other technologies in machine learning.
By way of example, the machine learning model may be any one of a neural network model, a logistic regression model, a linear regression model, a Support Vector Machine (SVM), and a Adaboost, XGboost, transformer-Encoder model.
The neural network model may be any one of a cyclic neural network-based model, a convolutional neural network-based model, and a transducer-encoder-based classification model, for example.
By way of example, the machine learning model may be a deep hybrid model of a cyclic neural network-based model, a convolutional neural network-based model, and a transducer-encoder-based classification model.
By way of example, the machine learning model may be any of an attention-based depth model, a memory network-based depth model, and a short text classification model based on deep learning.
The short text classification model based on deep learning is a Recurrent Neural Network (RNN) or a Convolutional Neural Network (CNN) or a variant based on the recurrent neural network or the convolutional neural network.
Illustratively, some simple domain adaptations may be made on an already pre-trained model to arrive at a machine learning model.
Exemplary, "simple domain adaptation" includes, but is not limited to, secondary pre-training with large-scale unsupervised domain corpus again on an already pre-trained model, and/or model compression of an already pre-trained model by way of model distillation.
Step S303: and if the probability is greater than or equal to a preset threshold value, searching a target high-risk message character contained in the input information and a target position of the target high-risk message character in the input information based on the preset high-risk message character.
For example, a collision password library based on SHA-1 can be used for obtaining high-risk message characters with high cracking probability if the high-risk message characters are encrypted based on SHA-1 only. By way of example, the high risk message characters may include one or more characters.
Assume that the input information is { J ] 1 J 2 J 3 J 4 J 5 J 6 If J 1 If the target high-risk message character is J 1 The target position is 1.
Step S304: and calculating to obtain a target character based on the target high-risk message character and the target position.
By way of example, the formula may be based on: lg (2) m And (4) calculating to obtain the target character by using the ASCII code of the target high-risk message character, wherein m is the target position.
Exemplary, if 2 m ASCII code of +the target high-risk message character is less than 2 64 Target character=2 m +ASCII codes of the target high-risk message characters; if 2 m The ASCII code of the+ target high-risk message character is more than or equal to 2 64 Then the target character=lg (2 m + ASCII code of the target high risk message character).
For example, 2 can be m The largest prime number in +1 is determined as the target character.
Step S305: and replacing the target high-risk character at the target position in the input information with the target character to obtain a first ciphertext.
Step S306: and encrypting the first ciphertext by using a secure hash algorithm 1 to obtain a second ciphertext.
Step S307: and storing the second ciphertext to the blockchain.
According to the ciphertext generation method, if the input information to be stored in the blockchain is encrypted only by using SHA-1, and the possibility of being cracked is higher than or equal to a preset threshold value, namely higher, the target high-risk message character contained in the input information and the target position of the target high-risk message character in the input information can be searched based on the preset high-risk message character; calculating to obtain a target character based on the target dangerous message character and the target position; replacing a target high-risk character at a target position in the input information with a target character to obtain a first ciphertext; so that the characters which are easy to crack in the input information are replaced, and the first ciphertext is encrypted by a secure hash algorithm 1 to obtain the second ciphertext; and storing the second ciphertext to the blockchain. Because the target high-risk message characters which are easy to crack in the input information are replaced, the first ciphertext does not comprise the target high-risk message characters which are easy to crack, namely, the second ciphertext obtained by performing the secure hash algorithm 1 on the first ciphertext cannot be cracked even if the known dictionary library of the SHA-1 is used, so that the security of the ciphertext is improved.
In an alternative implementation, the real method of step S306 includes the following steps a101 to a115.
Step A101: and expanding the length complementary bit of the first ciphertext into 512 x Q bits to obtain a first message, wherein Q is any integer greater than or equal to 1.
The bit-filling expansion method provided in the embodiment of the present application is various, and the embodiment of the present application provides but is not limited to the following three methods.
The first implementation of step a101 includes steps a11 to a14.
Step A11: and supplementing a1 at the tail 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, then the bit-fill expansion operation may not be required, and if the length of the first ciphertext is not an integer multiple of 512, then the bit-fill expansion operation may be required.
Step A12: and supplementing 0 after 1 of the first ciphertext bit until the remainder of the length of the second message after bit supplementation after modulo 512 is 448.
For example, if the remainder of the modulo 512 length of the first ciphertext is 448, steps a11 through a12 may not be performed. If the remainder of modulo 512 of the length of the first ciphertext is not 448, steps A11 through A12 may be performed.
Step A13: and supplementing a1 at the tail of the second message.
Step A14: and supplementing 63 0 s after the 1 s of the complementary bit of the second message to obtain the first message.
The following is illustrative for the sake of those skilled in the art to more understand the implementation of the first step a 101.
Fig. 4a is a schematic diagram of first ciphertext bit-complementary expansion according to an embodiment of the present application.
Assuming that the length of the first ciphertext is 600 bits, the modulo remainder of the first ciphertext pair 512 is 88, and after the first ciphertext pair is supplemented with one 1 and 359 0 s, a second message is obtained. And supplementing 1 and 63 0 after the second message to obtain the first message.
The second implementation of step a101 includes steps a21 to a23.
Step A21: and supplementing a1 at the tail 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, then the bit-fill expansion operation may not be required, and if the length of the first ciphertext is not an integer multiple of 512, then the bit-fill expansion operation may be required.
Step A22: and supplementing 0 after 1 of the first ciphertext bit until the remainder of the length of the second message after bit supplementation after modulo 512 is 448.
For example, if the remainder of the modulo 512 length of the first ciphertext is 448, steps a21 through a22 may not be performed. If the remainder of modulo 512 of the length of the first ciphertext is not 448, steps A21 through A22 may be performed.
Step A23: and supplementing 64 1 s at the tail of the second message to obtain the first message.
The following is illustrative for the sake of those skilled in the art to more understand the implementation of the second step a 101.
Fig. 4b is a schematic diagram of first ciphertext bit-complementary expansion according to an embodiment of the present application.
Assuming that the length of the first ciphertext is 600 bits, the modulo remainder of the first ciphertext pair 512 is 88, and after the first ciphertext pair is supplemented with one 1 and 359 0 s, a second message is obtained. And supplementing 64 1 s after the second message to obtain the first message.
The third implementation of step a101 includes steps a31 to a32.
Step A31: and supplementing a1 at the tail 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, then the bit-fill expansion operation may not be required, and if the length of the first ciphertext is not an integer multiple of 512, then the bit-fill expansion operation may be required.
Step A32: and supplementing 0 after the 1 of the first ciphertext bit until the remainder of the length of the first message after bit supplementing after modulo 512 is 0, so as to obtain the first message.
The following is illustrative for the sake of those skilled in the art to more understand the implementation of the third step a 101.
Fig. 4c is a schematic diagram of first ciphertext bit-complementary expansion according to an embodiment of the present application.
Assuming that the length of the first ciphertext is 600 bits, the modulo remainder of the first ciphertext pair 512 is 88, and 1 and 423 0 are supplemented after the first ciphertext to obtain the first message.
Step A102: the first message is divided into Q data blocks, and the bit number of the data blocks is 512.
Taking fig. 4a to 4c as an example, q=2.
In an exemplary embodiment of the present application, the first packet is divided into Q data blocks, and each 512 bits of data are obtained from the header of the first packet, then one data block is obtained.
Step A103: the initial value of G is set to 1.
Step A104: the following is performed for the G-th data block: the data block is divided into 16 target sub-data blocks, and the number of bits of the target sub-data blocks is 32 bits.
Step A105: and carrying out operation on the 16 target sub-data blocks to obtain 64 operation sub-data blocks so as to obtain 80 operation sub-data blocks Q (t), wherein the number of bits of the operation sub-data blocks is 32 bits, and the 80 sub-data blocks comprise 16 target sub-data blocks and 64 operation sub-data blocks.
In an alternative implementation, the implementation of step a105 is various, and embodiments of the present application provide, but are not limited to, the following implementation, and the method includes steps B11 to B14.
Step B11: the initial value of R is set to 0.
Step B12: let t=r, the following is performed:
step B13: when 0.ltoreq.t < 16, Q (t) =M t Wherein M is t T+1st target sub-data block; when 16.ltoreq.t.ltoreq.79, Q (t) =s1 (W t-3 XOR W t-14 XOR W t-16 ) The method comprises the steps of carrying out a first treatment on the surface of the Where S1 is the 1 bit shift to the left.
Step B14: let r=r+1, return to step B12 until R equals 80.
The 80 sub data blocks are sequentially: q (0), Q (1), Q (2), Q (3), …, Q (79).
In an alternative implementation, at least one of the 16 target sub-data blocks may be logically operated on to obtain 64 operator sub-data blocks. The exclusive or operation described above is not limited.
Step A106: obtaining 80 constants K which are preset t The method comprises the steps of carrying out a first treatment on the surface of the t has the values of 0, 1, 2, … and 79.
In an alternative implementation, 80 constants are different.
In an alternative implementation, the values of the 80 constants are as follows:
when t is more than or equal to 0 and less than or equal to 19, K t =a first preset value;
when t is more than or equal to 20 and less than or equal to 39, K t =a second preset value;
When t is more than or equal to 40 and less than or equal to 59, K t =third preset value;
when t is more than or equal to 60 and less than or equal to 79, K t =fourth preset value.
In an alternative implementation, the 80 constants corresponding to different data blocks may be different, for example, the correspondence between the 16 target sub-data blocks obtained in step S316 and the 80 constants may be preset. I.e. 80 constants vary from data block to data block.
In an alternative implementation, the 80 constants corresponding to different input information may be different, for example, the correspondence between the input information and the 80 constants may be preset. I.e. 80 constants, vary with the input information.
In an alternative implementation, the 80 constants corresponding to the 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 0xCA62C1D6.
The 80 sub-data blocks, in turn, illustratively include: 16 said target sub-data blocks and 64 said operator sub-data blocks.
The sequence of the 16 target sub-data blocks is as follows: and sorting according to the sequence of dividing the data blocks to obtain target sub-data blocks.
As shown in fig. 5, an ordering diagram of a data block divided into 16 target sub-data blocks.
Each time 32 bits of data are extracted from the head of the data block to obtain a target sub-data block, then the target sub-data block 1, the target sub-data block 2, the target sub-data block 3, the target sub-data blocks 4 and … and the target sub-data block 16 can be sequentially obtained. The order of the 16 target sub-data blocks is as follows: target sub-data block 1, target sub-data block 2, target sub-data block 3, target sub-data blocks 4, …, target sub-data block 16.
Step a107: acquiring the identity H of the buffer 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to be a constant value.
In an alternative implementation, for the first data block, i.e. when step a107 is performed for the first time, the identification H of the buffer and 16 sub-data blocks may be set in advance 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is the pair of initial values of (a)Searching the identification H of the buffer areas corresponding to the 16 target sub-data blocks in the corresponding relation 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to be a constant value.
I.e. H corresponding to different target sub-data blocks i Because the target sub-data block is related to the input information, randomness and the anti-riot cracking capability of the algorithm are increased, the algorithm performance consumption is smaller, and the method can be realized by transplanting on different platforms and hardware devices so as to meet the requirements of various use scenes of block chains in a financial service system.
In an alternative implementation, the buffer { Hi } is initialized to the following values:
H 0 =0x67452301
H 1 =0xEFCDAB89
H 2 =0x98BADCFE
H 3 =0x10325476
H 4 =0xC3D2E1F0
step A108: will H 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 The initial values of (a) are assigned to the first parameter, the second parameter, the third parameter, the fourth parameter and the fifth parameter, respectively.
Step A109: the initial value of P is set to 0.
Step A110: for t=p, the following calculation is performed:
TEMP=S 5 (H 0 )+f t (H 1 ,H 2 ,H 3 )+H 4 +Q(t)+K t ;H 4 =H 3 ;H 3 =H 2 ;H 2 =S 30 (H 1 );
H 1 =H 0 ;H 0 =temp; wherein f t (H 1 ,H 2 ,H 3 ) Is a preset function; s is S 5 (H 0 ) Refers to H 0 Shift left by 5 bits; s is S 30 (H 1 ) Refers to H 1 Left shift by 30 bits.
Exemplary, f t (H 1 ,H 2 ,H 3 ) Is preset to H 1 ,H 2 ,H 3 As a function of the argument, e.g. a preset function f t (H 1 ,H 2 ,H 3 ) The following are provided:
when t is more than or equal to 0 and less than or equal to 19, f t (H 1 ,H 2 ,H 3 )=(H 1 AND H 2 )or((NOT H 1 )AND H 3 );
When t is more than or equal to 20 and less than or equal to 39, f t (H 1 ,H 2 ,H 3 )=H 1 XOR H 2 XOR H 3
When t is more than or equal to 40 and less than or equal to 59, f t (H 1 ,H 2 ,H 3 )=(H 1 AND H 2 )or(H 1 AND H 3 )or(H 2 AND H 3 );
When t is more than or equal to 60 and less than or equal to 79, f t (H 1 ,H 2 ,H 3 )=H 1 XOR H 2 XOR H 3
In an alternative implementation, f t (H 1 ,H 2 ,H 3 ) Which may or may not be a piecewise function, this being merely an example and not for f t (H 1 ,H 2 ,H 3 ) Causing a limitation.
Step A111: setting p=p+1, returning to step a110 until P equals 80, to obtain the buffer identification H 0 Values of (H) 1 Values of (H) 2 Values of (H) 3 Values of (H) 4 Is a value of (2).
Step A112: let H 0 Final value = H 0 Value of + first parameter, H 1 Final value = H 1 Value of + second parameter, H 2 Final value = H 2 Value of (2 + third parameter, H 3 Final value = H 3 Value of (2 + third parameter, H 4 Final value = H 4 A value of + a fourth parameter.
Step A113: the H is treated with 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 The final values of (2) are respectively used as the identification H of the buffer area corresponding to the G+1st data block 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to be a constant value.
I.e. the second execution of step a107, the resulting identification H of the buffer i Initial value = H obtained the first time step a112 is performed i Final value of (2).
At the third execution of step A107, the obtained buffer identification H i Initial value = H obtained when step a112 is performed the second time i Final value of (2). And so on, will not be described in detail.
If the first message is divided into a plurality of data blocks, multiple iterations may be required, and H is obtained from the previous data block 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 Is H of the next data block 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 The final ciphertext is related to the iteration number, making the ciphertext more difficult to crack.
Step A114: setting g=g+1, returning to step a104 until G is greater than Q.
Step a115: according to H 0 、H 1 、H 2 、H 3 、H 4 In the order of (2), H 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 A 160-bit hash value of the final value of (c) is determined to be the second ciphertext.
It will be appreciated that H i The values of (2) are 32 bits long, so 5H i Constitute a 160-bit hash value.
In the present application, if the input information 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 block 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 For the H obtained for the last data block 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 The final value of the 160-bit ciphertext obtained is also related to the number of data blocks into which the input information is divided, and compared with the prior art, the violent cracking is more difficult, so that the safety of the ciphertext is improved.
Because the SHA-1 algorithm is used for a long time, an attacker has accumulated a considerable amount of dictionary libraries, and further strengthening processing is required on the secure hash algorithm 1 to further enhance the security and improve the dictionary attack cracking resistance of the attacker to adapt to the increasingly worsened security situation. According to the embodiment of the application, the high-risk character in the input information is replaced to obtain the first ciphertext, so that the input information is further reinforced, even if the hash value of the first ciphertext is leaked, the improved algorithm is invalid through the current dictionary library, the first ciphertext cannot be cracked, and the safety of the blockchain service is further enhanced.
By adopting the ciphertext generation method provided by the embodiment of the application, the safety of the characteristic value of the input information of the blockchain is improved, an attacker cannot use the current dictionary library of SHA-1 to reversely decrypt the characteristic value, and the possibility of violent cracking is avoided.
The method is described in detail in the embodiments disclosed in the application, and the method can be implemented by using various devices, so that the application also discloses a device, and a specific embodiment is given in the following detailed description.
As shown in fig. 6, a block diagram of a ciphertext generating apparatus according to an embodiment of the present application is provided, where the apparatus includes: a first obtaining module 61, a second obtaining module 62, a searching module 63, a calculating module 64, a replacing module 65, an encrypting module 66 and a storing module 67, wherein:
A first obtaining module 61, configured to obtain input information to be stored in a blockchain;
the second obtaining module 62 is configured to input the input information into a pre-constructed artificial intelligent model, obtain, through the artificial intelligent model, a probability that the input information is decrypted after being encrypted by the secure hash algorithm 1; the artificial intelligent model is obtained by taking sample input information as input, taking the probability of ciphertext encrypted by the safe hash algorithm 1 of the sample input information being cracked as a training target, and training a machine learning model;
the searching module 63 is configured to search, based on a preset high-risk message character, a target high-risk message character included in the input information and a target position of the target high-risk message character in the input information if the probability is greater than or equal to a preset threshold;
a calculation module 64, configured to calculate a target character based on the target high-risk message character and the target position;
a replacing module 65, configured to replace the target high-risk character at the target position in the input information with the target character, so as to obtain a first ciphertext;
an encryption module 66, configured to encrypt the first ciphertext with a secure hash algorithm 1 to obtain a second ciphertext;
A storage module 67, configured to store the second ciphertext into the blockchain.
In an alternative implementation, the encryption module includes:
the bit-filling expansion unit is used for filling and expanding the length bit of the first ciphertext into 512 x Q bits to obtain a first message, wherein Q is any integer greater than or equal to 1;
the first dividing unit is used for dividing the first ciphertext into Q data blocks, and the bit number of the data blocks is 512;
a first assignment unit configured to set an initial value of G to 1;
a second dividing unit for performing the following operations for the G-th data block: dividing the data block into 16 target sub-data blocks, wherein the bit number of the target sub-data blocks is 32;
the first calculation unit is used for carrying out operation on 16 target sub-data blocks to obtain 64 operation sub-data blocks so as to obtain 80 sub-data blocks Q (t), the number of bits of the operation sub-data blocks is 32 bits, the 80 sub-data blocks comprise 16 target sub-data blocks and 64 operation sub-data blocks, and the values of t are 0, 1, 2, … and 79;
a first acquisition unit for acquiring 80 constants K set in advance t The method comprises the steps of carrying out a first treatment on the surface of the t has the values of 0, 1, 2, … and 79;
A second acquisition unit for acquiring the identification H of the buffer area 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to an initial value of (1);
a second assignment unit for assigning H 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 The initial values of the (a) are respectively assigned to the first parameter, the second parameter, the third parameter, the fourth parameter and the fifth parameter;
a third assignment unit, configured to set an initial value of P to 0;
a second calculation unit for performing, for t=p, the following calculation:
TEMP=S 5 (H 0 )+f t (H 1 ,H 2 ,H 3 )+H 4 +Q(t)+K t ;H 4 =H 3 ;H 3 =H 2 ;H 2 =S 30 (H 1 );
H 1 =H 0 ;H 0 =temp; wherein f t (H 1 ,H 2 ,H 3 ) Is a preset function; s is S 5 (H 0 ) Refers to H 0 Shift left by 5 bits; s is S 30 (H 1 ) Refers to H 1 Left shift by 30 bits;
a fourth assigning unit, configured to set p=p+1, return to the second calculating unit until P is equal to 80, so as to obtain the identifier H of the buffer area 0 Values of (H) 1 Values of (H) 2 Values of (H) 3 Values of (H) 4 Is a value of (2);
a fifth assignment unit for letting H 0 Value=h 0 Value of + first parameter, H 1 Value=h 1 Value of + second parameter, H 2 Value=h 2 Value of (2 + third parameter, H 3 Value=h 3 Value of (2 + third parameter, H 4 Value=h 4 A value of +fourth parameter;
a sixth assigning unit for assigning the H 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 The final values of (2) are respectively used as the identification H of the buffer area corresponding to the G+1st data block 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to an initial value of (1);
a seventh assignment unit, configured to set g=g+1, and return to the second division unit until G is greater than Q;
a determining unit for according to H 0 、H 1 、H 2 、H 3 、H 4 In the order of (2), H 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 A 160-bit hash value of the final value of (2) is determined as the second ciphertext;
wherein the preset function f t (H 1 ,H 2 ,H 3 ) The method comprises the following steps:
when t is more than or equal to 0 and less than or equal to 19, f t (H 1 ,H 2 ,H 3 )=(H 1 AND H 2 )or((NOT H 1 )AND H 3 );
When t is more than or equal to 20 and less than or equal to 39, f t (H 1 ,H 2 ,H 3 )=H 1 XOR H 2 XOR H 3
When t is more than or equal to 40 and less than or equal to 59, f t (H 1 ,H 2 ,H 3 )=(H 1 AND H 2 )or(H 1 AND H 3 )or(H 2 AND H 3 );
When t is more than or equal to 60 and less than or equal to 79, f t (H 1 ,H 2 ,H 3 )=H 1 XOR H 2 XOR H 3
In an alternative implementation, the bit-fill expansion unit includes:
the first bit supplementing unit is used for supplementing one 1 at the tail of the first ciphertext;
a second bit-filling unit, configured to fill 0 after 1 of the first ciphertext bit-filling until a remainder of the length of the second message after bit filling after modulo 512 is 448;
the third bit supplementing unit is used for supplementing one 1 at the tail end of the second message;
and the fourth bit supplementing unit is used for supplementing 63 0 s after the 1 s of the bit supplementing of the second message so as to obtain the first message.
In an alternative implementation, the first computing unit includes:
a setting unit configured to set an initial value of R to 0;
a calculation unit for letting t=r, performing the following operations:
when 0.ltoreq.t < 16, Q (t) =M t Wherein M is t The target sub-data block is the t th target sub-data block;
when 16.ltoreq.t.ltoreq.79, Q (t) =s1 (W t-3 XOR W t-14 XOR W t-16 ) The method comprises the steps of carrying out a first treatment on the surface of the Wherein S1 is a left-pointing shift of 1 bit;
and the triggering unit is used for enabling R=R+1 to trigger the calculating unit until R is equal to 80.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Fig. 7 is a block diagram illustrating an apparatus for a server according to an exemplary 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 is not limited to the server, and the server may include more or less components than those shown in fig. 7, or may combine some components, or may be arranged with different components, as will be understood by those skilled in the art.
The following describes the respective constituent elements 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; by way of example, the processor 71 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that 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 (Central Processing Unit, CPU), or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present invention, etc.;
the Memory 72 may include a Memory such as a Random-Access Memory (RAM) 721 and a Read-Only Memory (ROM) 722, and may further include a mass storage device 723 such as at least 1 disk Memory and the like. Of course, the server may also include hardware required for other services.
The memory 72 is used for storing instructions executable by the processor 71. The processor 71 has a function of a ciphertext generating method.
A wired or wireless network interface 73 is configured to connect the server to a network.
The processor 71, memory 72, network interface 73, and I/O controller 74 may be interconnected by a communication bus 75, which may be an ISA (Industry Standard Architecture ) bus, PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus, or EISA (Extended Industry Standard Architecture ) bus, among others. The buses may be classified as address buses, data buses, control buses, 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, microcontrollers, microprocessors, or other electronic elements for executing the ciphertext generating methods described above.
In an exemplary embodiment, the disclosed embodiments provide a storage medium including instructions, such as memory 72 including instructions, executable by 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 ciphertext generating device, or the like.
In an exemplary embodiment, a computer readable storage medium is also provided, which can be directly loaded into an internal memory of a computer, such as the memory 72, and contains software code, and the computer program can implement the steps shown in any embodiment of the ciphertext generating method after being loaded and executed by the computer.
In an exemplary embodiment, a computer program product is also provided, which can be directly loaded into an internal memory of a computer, for example, a memory contained in the server, and contains software codes, and the computer program can implement the steps shown in any embodiment of the ciphertext generating method after being loaded and executed by the computer.
It should be noted that the ciphertext generating method, the ciphertext generating device, the server and the medium provided by the invention can be used in the blockchain field or the financial field. The foregoing is merely an example, and is not intended to limit the application fields of the ciphertext generating method, the ciphertext generating device, the server, and the medium provided by the present invention.
The features described in the respective embodiments in the present specification may be replaced with each other or combined with each other. For device or system class embodiments, the description is relatively simple as it is substantially similar to method embodiments, with reference to the description of method embodiments in part.
It is further noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like 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. The software modules may be disposed 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 (8)

1. A ciphertext generating method, comprising:
acquiring input information to be stored in a block chain;
inputting the input information into a pre-constructed artificial intelligent model, and obtaining the probability of being cracked after the input information is encrypted by a secure hash algorithm 1 through the artificial intelligent model; the artificial intelligent model is obtained by taking sample input information as input, taking the probability of ciphertext encrypted by the safe hash algorithm 1 of the sample input information being cracked as a training target, and training a machine learning model;
if the probability is greater than or equal to a preset threshold value, searching a target high-risk message character contained in the input information and a target position of the target high-risk message character in the input information based on a preset high-risk message character;
Calculating to obtain a target character based on the target high-risk message character and the target position;
replacing the target high-risk character at the target position in the input information with the target character to obtain a first ciphertext;
encrypting the first ciphertext by a secure hash algorithm 1 to obtain a second ciphertext;
and storing the second ciphertext to the blockchain.
2. The ciphertext generating method of claim 1, wherein the calculating a target character based on the target high risk message character and the target position comprises:
based on the formula: lg (2) m And (4) calculating to obtain the target character by using the ASCII code of the target high-risk message character, wherein m is the target position.
3. The ciphertext generating method of claim 1, wherein the step of encrypting the first ciphertext to the secure hash algorithm 1 to obtain the second ciphertext comprises:
expanding the length complementary bit of the first ciphertext into 512 x Q bits 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 bit number of each data block is 512;
Setting the initial value of G to be 1;
the following is performed for the G-th data block:
dividing the data block into 16 target sub-data blocks, wherein the bit number of the target sub-data blocks is 32;
performing operation on 16 target sub-data blocks to obtain 64 operation sub-data blocks so as to obtain 80 sub-data blocks Q (t), wherein the number of bits of the operation sub-data blocks is 32 bits, the 80 sub-data blocks comprise 16 target sub-data blocks and 64 operation sub-data blocks, and the values of t are 0, 1, 2, … and 79;
obtaining 80 constants K which are preset t The method comprises the steps of carrying out a first treatment on the surface of the t has the values of 0, 1, 2, … and 79;
acquiring the identity H of the buffer 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to an initial value of (1);
will H 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 The initial values of the (a) are respectively assigned to the first parameter, the second parameter, the third parameter, the fourth parameter and the fifth parameter;
setting the initial value of P to 0;
for t=p, the following calculation is performed:
TEMP=S 5 (H 0 )+f t (H 1 ,H 2 ,H 3 )+H 4 +Q(t)+K t ;H 4 =H 3 ;H 3 =H 2 ;H 2 =S 30 (H 1 );
H 1 =H 0 ;H 0 =temp; wherein f t (H 1 ,H 2 ,H 3 ) Is a preset function; s is S 5 (H 0 ) Refers to H 0 Shift left by 5 bits; s is S 30 (H 1 ) Refers to H 1 Left shift by 30 bits; setting p=p+1, returning to execute when t=p Until P is equal to 80, to obtain the identity H of the buffer 0 Values of (H) 1 Values of (H) 2 Values of (H) 3 Values of (H) 4 Is a value of (2);
let H 0 Final value = H 0 Value of + first parameter, H 1 Final value = H 1 Value of + second parameter, H 2 Final value = H 2 Value of (2 + third parameter, H 3 Final value = H 3 Value of (2 + third parameter, H 4 Final value = H 4 A value of +fourth parameter;
the H is treated with 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 The final values of (2) are respectively used as the identification H of the buffer area corresponding to the G+1st data block 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to an initial value of (1);
setting g=g+1, and returning to execute the operation step executed for the G data block until G is greater than Q;
according to H 0 、H 1 、H 2 、H 3 、H 4 In the order of (2), H 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 A 160-bit hash value of the final value of (2) is determined as the second ciphertext;
wherein the preset function f t (H 1 ,H 2 ,H 3 ) The method comprises the following steps:
when t is more than or equal to 0 and less than or equal to 19, f t (H 1 ,H 2 ,H 3 )=(H 1 AND H 2 )or((NOT H 1 )AND H 3 );
When t is more than or equal to 20 and less than or equal to 39, f t (H 1 ,H 2 ,H 3 )=H 1 XOR H 2 XOR H 3
When t is more than or equal to 40 and less than or equal to 59, f t (H 1 ,H 2 ,H 3 )=(H 1 AND H 2 )or(H 1 AND H 3 )or(H 2 AND H 3 );
When t is more than or equal to 60 and less than or equal to 79, f t (H 1 ,H 2 ,H 3 )=H 1 XOR H 2 XOR H 3
4. The ciphertext generating method of claim 3, wherein the expanding the length of the first ciphertext to be 512 x q bits to obtain the first message comprises:
Filling a 1 at the end of the first ciphertext;
supplementing 0 after 1 of the first ciphertext bit until the remainder of the length of the second message after bit supplementing modulo 512 is 448;
supplementing a 1 at the tail of the second message;
and supplementing 63 0 s after the 1 s of the complementary bit of the second message to obtain the first message.
5. A ciphertext generating apparatus, comprising:
the first acquisition module is used for acquiring input information to be stored in the blockchain;
the second acquisition module is used for inputting the input information into a pre-constructed artificial intelligent model, and obtaining the probability of being cracked after the input information is encrypted by the secure hash algorithm 1 through the artificial intelligent model; the artificial intelligent model is obtained by taking sample input information as input, taking the probability of ciphertext encrypted by the safe hash algorithm 1 of the sample input information being cracked as a training target, and training a machine learning model;
the searching module is used for searching target high-risk message characters contained in the input information and target positions of the target high-risk message characters in the input information based on preset high-risk message characters if the probability is larger than or equal to a preset threshold value;
The calculation module is used for calculating and obtaining a target character based on the target high-risk message character and the target position;
the replacing module is used for replacing the target high-risk character at the target position in the input information with the target character so as to obtain a first ciphertext;
the encryption module is used for encrypting the first ciphertext through a secure hash algorithm 1 so as to obtain a second ciphertext;
and the storage module is used for storing the second ciphertext to the block chain.
6. The ciphertext generating apparatus of claim 5, wherein the encryption module comprises:
the bit-filling expansion unit is used for filling and expanding the length bit of the first ciphertext into 512 x Q bits to obtain a first message, wherein Q is any integer greater than or equal to 1;
the first dividing unit is used for dividing the first ciphertext into Q data blocks, and the bit number of the data blocks is 512;
a first assignment unit configured to set an initial value of G to 1;
a second dividing unit for performing the following operations for the G-th data block: dividing the data block into 16 target sub-data blocks, wherein the bit number of the target sub-data blocks is 32;
the first calculation unit is used for carrying out operation on 16 target sub-data blocks to obtain 64 operation sub-data blocks so as to obtain 80 sub-data blocks Q (t), the number of bits of the operation sub-data blocks is 32 bits, the 80 sub-data blocks comprise 16 target sub-data blocks and 64 operation sub-data blocks, and the values of t are 0, 1, 2, … and 79;
A first acquisition unit for acquiring 80 constants K set in advance t The method comprises the steps of carrying out a first treatment on the surface of the t has the values of 0, 1, 2, … and 79;
a second acquisition unit for acquiring the identification H of the buffer area 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to an initial value of (1);
a second assignment unit for assigning H 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Initial value assignmentGiving a first parameter, a second parameter, a third parameter, a fourth parameter and a fifth parameter;
a third assignment unit, configured to set an initial value of P to 0;
a second calculation unit for performing, for t=p, the following calculation:
TEMP=S 5 (H 0 )+f t (H 1 ,H 2 ,H 3 )+H 4 +Q(t)+K t ;H 4 =H 3 ;H 3 =H 2 ;H 2 =S 30 (H 1 );
H 1 =H 0 ;H 0 =temp; wherein f t (H 1 ,H 2 ,H 3 ) Is a preset function; s is S 5 (H 0 ) Refers to H 0 Shift left by 5 bits; s is S 30 (H 1 ) Refers to H 1 Left shift by 30 bits;
a fourth assigning unit, configured to set p=p+1, return to the second calculating unit until P is equal to 80, so as to obtain the identifier H of the buffer area 0 Values of (H) 1 Values of (H) 2 Values of (H) 3 Values of (H) 4 Is a value of (2);
a fifth assignment unit for letting H 0 Final value = H 0 Value of + first parameter, H 1 Final value = H 1 Value of + second parameter, H 2 Final value = H 2 Value of (2 + third parameter, H 3 Final value = H 3 Value of (2 + third parameter, H 4 Final value = H 4 A value of +fourth parameter;
a sixth assigning unit for assigning the H 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 The final values of (2) are respectively used as the identification H of the buffer area corresponding to the G+1st data block 0 Initial value of (H) 1 Initial value of (H) 2 Initial value of (H) 3 Initial value of (H) 4 Is set to an initial value of (1);
a seventh assignment unit, configured to set g=g+1, and return to the second division unit until G is greater than Q;
a determining unit for according to H 0 、H 1 、H 2 、H 3 、H 4 In the order of (2), H 0 Final value of H 1 Final value of H 2 Final value of H 3 Final value of H 4 A 160-bit hash value of the final value of (2) is determined as the second ciphertext;
wherein the preset function f t (H 1 ,H 2 ,H 3 ) The method comprises the following steps:
when t is more than or equal to 0 and less than or equal to 19, f t (H 1 ,H 2 ,H 3 )=(H 1 AND H 2 )or((NOT H 1 )AND H 3 );
When t is more than or equal to 20 and less than or equal to 39, f t (H 1 ,H 2 ,H 3 )=H 1 XOR H 2 XOR H 3
When t is more than or equal to 40 and less than or equal to 59, f t (H 1 ,H 2 ,H 3 )=(H 1 AND H 2 )or(H 1 AND H 3 )or(H 2 AND H 3 );
When t is more than or equal to 60 and less than or equal to 79, f t (H 1 ,H 2 ,H 3 )=H 1 XOR H 2 XOR H 3
7. 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 ciphertext generating method of any one of claims 1 to 4.
8. A computer readable storage medium, which when executed by a processor of a server, causes the server to perform the ciphertext generating method of any one of claims 1 to 4.
CN202111404982.7A 2021-11-24 2021-11-24 Ciphertext generating method, ciphertext generating device, server and medium Active CN114124358B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111404982.7A CN114124358B (en) 2021-11-24 2021-11-24 Ciphertext generating method, ciphertext generating device, server and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111404982.7A CN114124358B (en) 2021-11-24 2021-11-24 Ciphertext generating method, ciphertext generating device, server and medium

Publications (2)

Publication Number Publication Date
CN114124358A CN114124358A (en) 2022-03-01
CN114124358B true CN114124358B (en) 2023-12-22

Family

ID=80372151

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111404982.7A Active CN114124358B (en) 2021-11-24 2021-11-24 Ciphertext generating method, ciphertext generating device, server and medium

Country Status (1)

Country Link
CN (1) CN114124358B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109271797A (en) * 2018-09-12 2019-01-25 郑州云海信息技术有限公司 A kind of method and system improving the safety of database sensitive information
CN109409033A (en) * 2018-09-11 2019-03-01 平安科技(深圳)有限公司 Code encryption method, apparatus, computer installation and storage medium
CN112134689A (en) * 2020-09-28 2020-12-25 中国银行股份有限公司 Ciphertext generation method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109409033A (en) * 2018-09-11 2019-03-01 平安科技(深圳)有限公司 Code encryption method, apparatus, computer installation and storage medium
CN109271797A (en) * 2018-09-12 2019-01-25 郑州云海信息技术有限公司 A kind of method and system improving the safety of database sensitive information
CN112134689A (en) * 2020-09-28 2020-12-25 中国银行股份有限公司 Ciphertext generation method and device

Also Published As

Publication number Publication date
CN114124358A (en) 2022-03-01

Similar Documents

Publication Publication Date Title
US9892211B2 (en) Searchable code processing system and method
US8300828B2 (en) System and method for a derivation function for key per page
JP6238867B2 (en) Sequential biometric cryptographic system and sequential biometric cryptographic processing method
JP2018511261A (en) User identification system based on proof of work
CN113094747A (en) Image searching method, block chain, cloud server and image searching device
CN107078899A (en) The method of obfuscated data
CN111953699A (en) Data encryption method and system based on block chain
US20160301524A1 (en) Methods and apparatuses of digital data processing
US20220004621A1 (en) Data recovery through reversal of hash values using probabilistic data structures
US9594918B1 (en) Computer data protection using tunable key derivation function
CN115314889A (en) Multi-level security authentication method and system for power regulation and control terminal, memory and equipment
CN114124358B (en) Ciphertext generating method, ciphertext generating device, server and medium
CN113067816A (en) Data encryption method and device
CN107947944B (en) Incremental signature method based on lattice
You et al. A novel fuzzy vault scheme based on fingerprint and finger vein feature fusion
CN116070272A (en) Biological feature matching method, terminal equipment, server, system and medium
CN114124357B (en) Ciphertext generation method, server, medium and device based on Fourier series
CN114124356B (en) Ciphertext generation method, server, medium and device applied to blockchain
EP3238367B1 (en) Technique for generating a password
KR20210072711A (en) Method and apparatus for mutual authentication between internet of things device and trusted server
Yang et al. Improved hash functions for cancelable fingerprint encryption schemes
CN114091070A (en) Hilbert transform-based ciphertext generation method, server, medium, and apparatus
CN114374505A (en) Ciphertext generating method, device, server, medium and product
CN114091117A (en) Data storage method, server, medium, and apparatus
Alpatskiy et al. New Approach in the Rainbow Tables Method for Human-Like Passwords

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
GR01 Patent grant
GR01 Patent grant