Verification code generation, verification method, device, equipment and storage medium
By generating an offline verification code, combining the operation type and terminal identification, and using reverse mapping and hash functions to verify the correctness of the operation, the problem of being unable to verify offline in the existing technology is solved, and the security and reliability of data center operations are improved.
Patent Information
- Application Number
- CN202510956625.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-07-11
AI Technical Summary
In the existing technology, verification codes need to rely on the network environment and cannot verify the correctness of operations when they are disconnected from the network. As a result, when operators in the data center make judgments or execute errors, they are prone to cause systemic operation and maintenance accidents.
By combining the operation type, the terminal identification to be verified and the current time, an offline verification code is generated, and the characteristic value is calculated using the inverse mapping table and hash function to verify the time and terminal consistency of the operation, and a verification code is generated and verified to ensure the correctness of the operation.
It realizes the verification of the correctness of operations in a network-free environment, reduces the possibility of operational errors, and improves the security and reliability of data center operations.
Smart Images

Figure CN120474724B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to generation of verification codes, verification methods, devices, equipment, and storage media. Background Art
[0002] During large-scale data center operations, operators can easily cause systemic O&M incidents due to operator misjudgment or operational errors during critical steps such as firmware configuration, batch upgrades, and high-risk operations. This requires verifying the correctness of the operations performed by operators.
[0003] In related technologies, verification codes are mainly used as a way to verify identity and can only be used when there is a network connection. Since some servers are managed offline, there is an urgent need for a verification code that can verify the correctness of operations in an offline environment. Summary of the Invention
[0004] The present application provides a verification code generation, verification method, apparatus, device and storage medium to at least solve the problem in the related art of urgently needing a verification code that can verify the correctness of operation in an off-network environment.
[0005] The present application provides a verification code verification method, comprising: if an operation to be verified is detected, determining the operation type to be verified of the operation to be verified; obtaining the verification code to be verified, the terminal identifier to be verified and the current time; determining the last K bits of the verification code to be verified as the shortened time feature to be verified, where K is a positive integer; determining a reverse mapping table according to the terminal identifier to be verified; using the reverse mapping table to reversely map the shortened time feature to be verified to the time feature to be verified; if the current time is outside the range corresponding to the time feature to be verified, outputting a time error message; splicing the operation type to be verified, the preset character string and the terminal identifier to be verified to obtain a spliced field ; Calculate the characteristic value of the spliced field; Determine the target character string according to the characteristic value of the time feature to be verified and the spliced field; If the preset position of the verification code to be verified is different from the target character string, output a prompt message that the operated terminal is inconsistent; Splice the target character string, the time feature to be verified and the shortened time feature to be verified, and calculate the characteristic value to obtain the combined characteristic value to be verified; Using the first preset value as the divisor, calculate the remainder of the last two digits of the time feature to be verified to obtain the target remainder; If the character at the position of the target remainder in the combined characteristic value to be verified is different from the first character of the verification code to be verified, output a prompt that the check code is illegal, and intercept the operation to be verified.
[0006] The present application also provides a verification code generation method, including: obtaining the starting time, effective duration, identifier of the operated terminal and operation type of an operation; splicing the starting time and effective duration to obtain a time feature; determining a mapping table to be used according to the identifier of the operated terminal; using the mapping table to be used to map the time feature to a shortened time feature; splicing the operation type, a preset character string and the identifier of the operated terminal to obtain a combined character string; determining a simplified character string according to the combined character string and the time feature; splicing the simplified character string, the time feature and the shortened time feature to obtain a spliced character string; using a second hash function to calculate a feature value of the spliced character string to obtain a combined feature value; using a first preset value as a divisor, calculating the remainder of the effective duration to obtain a duration remainder; using the value of the position of the duration remainder in the combined feature value, the simplified character string and the shortened time feature to splice to obtain a verification code.
[0007] The present application also provides a verification code verification device, including: a type determination module, for determining the type of operation to be verified of the operation to be verified if an operation to be verified is detected; a parameter acquisition module, for obtaining the verification code to be verified, the terminal identifier to be verified and the current time; a feature determination module, for determining the last K bits of the verification code to be verified as the shortened time feature to be verified, where K is a positive integer; a table determination module, for determining a reverse mapping table according to the terminal identifier to be verified; a reverse mapping module, for reversely mapping the shortened time feature to be verified to the time feature to be verified using the reverse mapping table; a first output module, for outputting a time error message if the current time is outside the range corresponding to the time feature to be verified; a character combination module, for splicing the operation type to be verified, the preset character string and the terminal identifier to be verified to obtain a spliced field; a characteristic value calculation module for calculating the characteristic value of the spliced field; a character string determination module for determining the target character string according to the time feature to be verified and the characteristic value of the spliced field; a second output module for outputting a prompt message indicating that the operated terminal is inconsistent if the preset position of the verification code to be verified is different from the target character string; the characteristic value calculation module is also used to splice the target character string, the time feature to be verified and the shortened time feature to be verified, and calculate the characteristic value to obtain the combined characteristic value to be verified; a remainder calculation module for calculating the remainder of the last two digits of the time feature to be verified with the first preset value as the divisor to obtain the target remainder; a character comparison module for outputting a prompt indicating that the verification code is illegal and intercepting the operation to be verified if the character at the position of the target remainder in the combined characteristic value to be verified is different from the first character of the verification code to be verified.
[0008] The present application also provides a verification code generation device, including: a data acquisition module, used to obtain the starting time, effective duration, identifier of the operated terminal and operation type of an operation; a time splicing module, used to splice the starting time and effective duration to obtain a time feature; a mapping table determination module, used to determine the mapping table to be used according to the identifier of the operated terminal; a time mapping module, used to use the mapping table to be used to map the time feature into a shortened time feature; a first splicing module, used to splice the operation type, a preset character string and the identifier of the operated terminal to obtain a combined character string; a character simplification module, used to determine a simplified character string according to the combined character string and the time feature; a second splicing module, used to splice the simplified character string, the time feature and the shortened time feature to obtain a spliced character string; a feature calculation module, used to calculate the feature value of the spliced character string using a second hash function to obtain a combined feature value; a remainder calculation module, used to calculate the remainder of the effective duration with a first preset value as a divisor to obtain a duration remainder; and a verification code splicing module, used to splice the value of the position of the duration remainder in the combined feature value, the simplified character string and the shortened time feature to obtain a verification code.
[0009] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any one of the above-mentioned verification method generation methods or verification code verification methods when executing the computer program.
[0010] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above-mentioned verification method generation methods or verification code verification methods are implemented.
[0011] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned verification method generation methods or verification code verification methods when the computer program is executed by a processor.
[0012] Through this application, the verification code to be verified is decrypted in combination with the operation type, the verification code to be verified, the terminal identification to be verified and the current time, and the decrypted information is used to verify whether the obtained operation type, the verification code to be verified, the terminal identification to be verified and the current time meet the requirements of the decrypted information, thereby realizing the verification of the operation time, operation type and the correctness of the operated terminal in an offline environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0014] Figure 1 Schematic diagram of application scenarios provided by embodiments of the present application;
[0015] Figure 2 A flowchart of a verification code verification method provided in an embodiment of the present application;
[0016] Figure 3 A flowchart of a verification code generation method provided in an embodiment of the present application;
[0017] Figure 4 A schematic diagram of the structure of a verification code verification device provided in an embodiment of the present application;
[0018] Figure 5 A schematic diagram of the structure of a verification code generating device provided in an embodiment of the present application;
[0019] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0021] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0022] In the large-scale operation scenario of data centers, operators are prone to cause systemic operation and maintenance accidents due to operational judgment or execution errors in key links such as firmware configuration, batch upgrades, and high-risk operations. To avoid this situation, the correctness of the operation can be verified during the operation process.
[0023] In the existing technology, verification codes are mainly used for identity authentication and rely on the network environment. Since some servers adopt an offline management mode, there is an urgent need for a verification code solution that can verify the correctness of operations in an offline environment.
[0024] The inventors propose the following technical concept: by combining the time when the operation is allowed, the type of operation and the identifier of the operated terminal, an offline verification code is generated, and the verification code is verified offline during the operation.
[0025] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0026] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the verification code generation method depends, the specific application environment architecture or specific hardware architecture is described here. Figure 1 , Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, after the reviewer receives the operation application from the applicant or operator, if the review is passed, the review terminal generates a corresponding verification code based on the operation application, and gives the verification code to the operator, or directly sends it to the operation terminal corresponding to the operator, and the operation terminal verifies the verification code when maintaining the operated terminal.
[0027] The audit terminal and the operation terminal may be a mobile phone, a tablet computer, a computer, a laptop computer, etc. The operated device may include a server. In some possible implementations, the operated device may also be a computer, a mobile phone, etc.
[0028] Figure 2 The flowchart of the verification code verification method provided by the embodiment of the present application is as follows. The verification code verification method is used to verify whether the verification code generated by any of the above embodiments is correct. Figure 2 As shown, the verification code verification method includes:
[0029] S201: If an operation to be verified is detected, determine the type of the operation to be verified.
[0030] This step may include, after receiving the operation instruction input by the staff, searching for the correspondence between the operation instruction and the operation type to obtain the type of operation to be verified. It may also include receiving the operation to be verified input by the staff, reading the operation type-related field in the operation to be verified, and obtaining the type of operation to be verified. The operation to be verified may also include clicking a button, and determining the corresponding type of operation to be verified based on the clicked button.
[0031] The types of operations to be verified include system upgrades, configuration file editing, etc.
[0032] S202: Obtain the operation type, the verification code to be verified, the terminal identifier to be verified, and the current time.
[0033] This step includes receiving the operation type, verification code to be verified, and terminal identifier to be verified, input by the operator. It may also include receiving the verification code to be verified from the review terminal, sending an identifier acquisition request to the operated terminal, and receiving the terminal identifier to be verified returned by the operated terminal in response to the identifier acquisition request. The operation type can be obtained through the operator's selection or operation. The current time can be obtained by obtaining the timestamp.
[0034] S203: Determine the last K digits of the verification code to be verified as the shortened time feature to be verified, where K is a positive integer.
[0035] In this step, the size of K may be the same as the number of characters of the shortened time feature obtained in step S204 below.
[0036] In a possible implementation, since the shortened time feature to be verified obtained by mapping using the mapping table is a character string with a length of 3, K can be 3.
[0037] S204: Determine a reverse mapping table according to the terminal identifier to be verified.
[0038] In this step, the corresponding relationship between the preset identifier and the mapping table can be searched according to the identifier of the terminal to be verified, so as to obtain the mapping table to be used corresponding to the identifier of the terminal to be verified.
[0039] S205: using a reverse mapping table to reversely map the shortened time feature to be verified into the time feature to be verified.
[0040] This step uses the shortened time feature to be verified to find the plaintext corresponding to the ciphertext in the reverse mapping table to obtain the time feature to be verified.
[0041] S206: If the current time is outside the range corresponding to the time feature to be verified, output a time error message.
[0042] In this step, since the time feature to be verified includes a start time and a valid duration, the start time and end time (the sum of the start time and the valid duration) are obtained, which is the range corresponding to the time feature to be verified. This allows us to determine whether the current time is within the range corresponding to the time feature to be verified. If the current time is within the range corresponding to the time feature to be verified, the subsequent verification steps will be continued.
[0043] S207: Concatenate the operation type, the preset character string, and the identifier of the terminal to be verified to obtain a concatenated field.
[0044] The preset character string may correspond to the identification of the operated terminal and be pre-stored in the operating terminal, or may be pre-set by the staff.
[0045] S208: Calculate the characteristic value of the concatenated field.
[0046] In this step, the second hash function mentioned above may be used to calculate the characteristic value of the concatenated field.
[0047] S209: Determine the target character string according to the time feature to be verified and the feature value of the splicing field.
[0048] In this step, the hash value of the splicing field is calculated, and the reading position is determined according to the year, month, day, and effective duration in the time feature to be verified. The characters corresponding to the reading position in the hash value of the splicing field are read and spliced to obtain a simplified string.
[0049] Among them, the reading position is determined according to the year, month, day and effective duration in the time feature to be verified, which may include directly using the year, month, day and effective duration as the reading position, or using the remainder of the year, month, day, effective duration and a preset value (the length of the hash value or the difference between the length of the hash value and a preset positive integer) as the reading position.
[0050] For example, the hash value of the concatenated field is "d6d8f1308ef9e86ad87333c77e864c06", and the year, month, day, and effective duration in the time feature to be verified are 25, 2, 18, and 10, respectively. Then, the 25th bit (7), the 2nd bit (6), the 18th bit (8), and the 10th bit (e) of the hash value of the concatenated field are read, and the result is 768e, which is a simplified string. If counting from 0, the 25th bit (e), the 2nd bit (d), the 18th bit (7), and the 10th bit (f) are read, and the result is ed7f, which is a simplified string. Counting from 0 or 1 is pre-set.
[0051] S210: If the preset position of the verification code to be verified is different from the target character string, outputting a prompt message indicating that the operated terminal is inconsistent.
[0052] In this step, the preset bits may correspond to the length of the target character string.
[0053] S211: Concatenate the target character string, the time feature to be verified, and the shortened time feature to be verified, and calculate feature values to obtain a combined feature value to be verified.
[0054] In this step, if the target string is "763k," the time signature to be verified is "25070302," and the shortened time signature to be verified is "23e," the resulting concatenated string is "763k2507030223e." For another example, if the target string is "93L6," the time signature to be verified is "25010603," and the shortened time signature to be verified is "89j," the resulting concatenated string is "93L62501060389j." SHA256 or MD5 is used to calculate the feature value to obtain the combined feature value to be verified.
[0055] S212: Using the first preset value as a divisor, calculate the remainder of the last two digits of the time feature to be verified to obtain a target remainder.
[0056] In this step, for example, if the second preset value is 32 and the last two digits of the time feature to be verified are 07, then the target remainder is 07. For another example, if the second preset value is 16 and the last two digits of the time feature to be verified are 20, then the target remainder is 4. The first preset value used in this step is the same as the preset value used in step S209 above.
[0057] S213: If the character at the position of the target remainder in the combined characteristic value to be verified is different from the first character of the verification code to be verified, a prompt indicating that the verification code is illegal is output, and the verification operation to be verified is intercepted.
[0058] In this step, for example, if the combined feature value to be verified is a9c005797df244eab0d8aa1c2ae96214 and the target remainder is 7, and the combined feature value to be verified is counted from 0 to the 7th position, the character obtained is 9, and the first character of the verification code is also 9, then the check code is legal and the operation continues. If the character at the position of the target remainder is 2 and the first character of the verification code is 8, a prompt indicating that the check code is illegal is output and the verification operation is blocked.
[0059] The interception operation may be to not execute the instructions input by the staff.
[0060] From the description of the above embodiments, it can be seen that the embodiment of the present disclosure decrypts the verification code to be verified by combining the operation type, the verification code to be verified, the terminal identification to be verified and the current time, and uses the decrypted information to verify whether the obtained operation type, the verification code to be verified, the terminal identification to be verified and the current time meet the requirements of the decrypted information, thereby realizing the verification of the operation time, operation type and the correctness of the operated terminal in an offline environment.
[0061] In a possible implementation, the above step S209, which determines the target character string according to the time feature to be verified and the feature value of the spliced field, includes: step S2091 and step S2092.
[0062] S2091: Calculate a first characteristic value of the concatenated field using a first hash function.
[0063] In this step, the first hash function is, for example, SHA256.
[0064] For example, the first characteristic value calculated when the spliced field is "BIOS upgrade ryalii5ATS1268" is "0ac05ff04b24f91d8de4ff00b33ecaa6a25aea52081691d4c351012ec864e50d".
[0065] S2092: Input the time feature to be verified and the first feature value into a multi-dimensional dynamic hash mapping algorithm to obtain a target character string.
[0066] In this step, the time feature to be verified and the first feature value are input as variables into the multi-dimensional dynamic hash mapping algorithm to obtain the output value of the multi-dimensional dynamic hash mapping algorithm, that is, the target character string.
[0067] From the description of the above embodiments, it can be seen that the embodiment of the present disclosure calculates the first characteristic value of the spliced field by using the first hash function, encrypts the content of the spliced field, and simplifies the string through dynamic hash mapping to obtain the target string, thereby reducing the length of the generated verification code while encrypting.
[0068] In a possible implementation, in step S2092, the time feature to be verified and the first feature value are input into a multi-dimensional dynamic hash mapping algorithm to obtain a target character string, including:
[0069] S921: Split the time feature to be verified into year, month, day and effective duration.
[0070] In this step, the characters in the time feature to be verified may be split bit by bit to obtain the year, month, day and valid duration.
[0071] For example, in 25050407, 25 represents the year, 05 represents the month, 04 represents the day, and 07 represents the validity period; for another example, in 24030510, 24 represents the year, 03 represents the month, 05 represents the day, and 10 represents the validity period.
[0072] S922: Perform an XOR operation on the year and the month in binary format to obtain a first binary value.
[0073] In this step, the time feature to be verified takes "25050407" as an example. The year 25 is represented as 00011001 in binary, and the month 05 is represented as 00000101 in binary. The XOR operation between the two is 00011100.
[0074] S923: Shift the first binary value left by three bits and fill the lower bits with 0 to obtain a second binary value.
[0075] In this step, referring to the example in S922 , the first binary value is shifted left by three bits to obtain 11100000.
[0076] S924: Convert the second binary value into decimal to obtain a first salt value.
[0077] In this step, referring to the example in S923 , the second binary value is converted to decimal 224. Therefore, the first salt value is 224.
[0078] S925: Add the day and the effective time, and then multiply it by the month to obtain a second salt value.
[0079] In this step, if the day is 04, the effective duration is 07, and the month is 05, the second salt value is "(4+7)×5=55". If the day is 05, the effective duration is 10, and the month is 03, the second salt value is "(5+10)×3=45".
[0080] S926: Determine the first coordinate, the second coordinate, and the third coordinate according to the first salt value, the second salt value, and the first characteristic value.
[0081] In this step, the first eigenvalue is converted into a numerical value, and then the remainder of the first salt value and the preset numerical value (the length of the first eigenvalue after conversion) is calculated, the remainder of the second salt value and the preset numerical value, and the remainder of the sum of the first salt value and the second salt value and the preset numerical value are calculated to obtain three coordinates.
[0082] S927: Combining the three characters corresponding to the first coordinate, the second coordinate, and the third coordinate in the first eigenvalue into a target character string.
[0083] In this step, you can count each coordinate from 0 or 1. During the verification process of the verification code, you need to count in the same way. For example, if the characters corresponding to the three coordinates are 1, 9, and e, the target string is 19e.
[0084] From the description of the above embodiments, it can be seen that the embodiments of the present disclosure calculate the salt value based on the time feature to be verified, and determine the target string by combining the salt value and the first feature value, thereby realizing encryption of the time feature to be verified and the first feature value, thereby increasing the security of the verification code.
[0085] In a possible implementation, in step S926, determining the first coordinate, the second coordinate, and the third coordinate according to the first salt value, the second salt value, and the first characteristic value includes:
[0086] S92601: Perform an OR operation on the lower N bits of the first salt value and the lower N bits of the second salt value shifted right by M bits to obtain a sum of the salt values, where M and N are positive integers.
[0087] This step can be performed by performing an AND operation on the first salt value and a preset binary value to obtain the lower N bits of the first salt value. Similarly, the lower N bits of the second salt value are obtained by right-shifting M bits. N is less than the number of characters in the first and second salt values. M can be, for example, 1, 2, or 3.
[0088] For example, the first salt value "11100000" and "00111111" are ANDed to obtain "00100000". The second salt value 00110111 is right-shifted by 2 bits to obtain 00001101, which is then ANDed with the lower N bits of the first salt value "00100000" to obtain "00101101".
[0089] S92602: Using the second preset value as a divisor, calculate the remainder of the sum of the salt value and the second salt value, and determine it as the first coordinate.
[0090] In this step, for example, the salt value "00101101" is 45 in decimal, the second salt value is 55, and the second preset value is 64. Then, the first coordinate is the remainder of 100 divided by 64, which is 36.
[0091] S92603: Using the second preset value as a divisor, calculate the remainder of the first salt value to obtain the cutting coordinates.
[0092] In this step, for example, if the first salt value is 224 and the second preset value is 64, the remainder is 224-3×64=32, and the cutting coordinate is 32.
[0093] S92604: Divide the first eigenvalue into a first part and a second part based on the cutting coordinate.
[0094] In this step, for example, if the length of the first characteristic value is 63 (the first bit is counted starting from 0), bits 0 to 31 are divided into the first part, and bits 32 to 63 are divided into the second part.
[0095] S92605: Reverse the order of the first and second parts and concatenate them to obtain a reversed string.
[0096] In this step, for example, if the first part is "0ac05ff04b24f91d8de4ff00b33ecaa6" and the second part is "a25aea52081691d4c351012ec864e50d", the reversed string becomes "a25aea52081691d4c351012ec864e50d0ac05ff04b24f91d8de4ff00b33ecaa6". The lengths of the first and second parts are related to the cut coordinates and the length of the first eigenvalue itself.
[0097] S92606: Using the second preset value as a divisor, calculate the remainder of the second salt value to obtain the target character position.
[0098] In this step, for example, if the second salt value is 55 and the second preset value is 64, the remainder is 55 and the target character position is 55. For another example, if the second salt value is 100 and the second preset value is 64, the remainder is 36 and the target character position is 36.
[0099] S92607: Convert the characters of the target character position in the reversed string into a preset format to obtain the target character value.
[0100] In this step, for example, if the target character position is 55, and the reverse character string is shown in step S92605 above, the target character value is "0". Converting "0" to ASCII code yields a target character value of 48, which is 00110000 in binary.
[0101] S92608: Perform an XOR operation on the second binary salt value and the binary target character value to obtain a remainder operation value.
[0102] In this step, for example, the second salt value in binary is "00110111" and the target character value in binary is "00110000", then the remainder value obtained by the XOR operation is "00000111", which is 7 in decimal.
[0103] S92609: Using the second preset value as a divisor, calculate the remainder of the remainder operation value to obtain the second coordinate.
[0104] In this step, for example, referring to step S92608, if the second preset value is 64 and the remainder calculation value is 7, then the remainder is 7 and the second coordinate is 7. For another example, if the second preset value is 32 and the remainder calculation value is 16, then the remainder is 16 and the second coordinate is 16.
[0105] S92610: Move the target character of the first eigenvalue to X positions after the target character to obtain a hash window string.
[0106] In this step, for example, if X is 8, the characters from the target character position (55) to the target character position plus 8 (55+8=63) in the first eigenvalue are read to obtain the hash window string.
[0107] Wherein, X is a positive integer, such as 6, 7, or 8.
[0108] S92611: Convert each bit in the hash window string into a numeric value and add them together to obtain the window value.
[0109] In this step, each bit in the hash window string is converted into an ASCII code to obtain multiple numerical values, and the numerical values are added together to obtain the window value.
[0110] For example, the hash window string is "ec864e50", the ASCII code of e is 101, the ASCII code of c is 99, the ASCII code of 8 is 56, the ASCII code of 6 is 54, the ASCII code of 4 is 52, the ASCII code of e is 101, the ASCII code of 5 is 53, and the ASCII code of 0 is 48. The sum is 101+99+56+54+52+101+53+48=564.
[0111] S92612: Using the second preset value as a divisor, calculate the remainder of the window value to obtain the third coordinate.
[0112] In this step, the second preset value is, for example, 64, and the remainder of the window value (the third coordinate) is 52.
[0113] From the description of the above embodiments, it can be seen that the embodiments of the present disclosure convert the time features and hash values to be verified into three-dimensional indexes through a multi-dimensional and multi-mode operation combination, thereby enhancing the irreversibility and randomness of the process.
[0114] In a possible implementation, in the above step S204 , determining the reverse mapping table according to the terminal identifier to be verified includes: steps S2041 to S2043 .
[0115] S2041: Calculate a second characteristic value of the terminal identifier to be verified using a second hash function, where the second characteristic value consists of K digits, where K is a positive integer.
[0116] In this step, the second characteristic value is a hexadecimal character string.
[0117] For example, if the terminal identifier to be verified is 5ATS1268, the calculated second characteristic value is 38f9138456f74ffedb54ca8bace10f16, and each digit in the second characteristic value is a hexadecimal number.
[0118] S2042: Add the K numbers and take the remainder with the third preset value as the divisor to obtain the offset.
[0119] In this step, for example, if the sum of K numbers is 241 and the third preset value is 31, the offset is 24. For another example, if the sum of K numbers is 325 and the third preset value is 32, the offset is 5.
[0120] S2043: According to the offset, change the mapping relationship of the preset mapping table to obtain a reverse mapping table.
[0121] In this step, the mapping relationships in the mapping table are rotated according to the value of the offset to obtain a reverse mapping table.
[0122] From the description of the above embodiments, it can be seen that the embodiment of the present disclosure calculates the hash value of the terminal identification to be verified so that the terminal identification to be verified can be converted into a numerical value, and then the numerical values are added and the remainder is taken, and the mapping relationship of the mapping table is changed using the remainder to complete the encryption of the mapping relationship and increase the security of the generated verification code.
[0123] In a possible implementation, the preset mapping table consists of plaintext and corresponding ciphertext.
[0124] The preset mapping table is as shown in Table 1:
[0125] Table 1 Mapping table
[0126]
[0127] In the above step S2043, the mapping relationship of the preset mapping table is changed according to the offset to obtain a reverse mapping table, including:
[0128] S20431: Shift the ciphertext corresponding to each plaintext in the preset mapping table by the offset to obtain a reverse mapping table.
[0129] In this step, the ciphertext corresponding to the plaintext may be shifted left or right by the offset to obtain a reverse mapping table.
[0130] For example, when the offset is 24, the ciphertext is shifted right and the reverse mapping table is as follows:
[0131] Table 2 Inverse mapping table
[0132]
[0133] As can be seen from the description of the above embodiments, the embodiments of the present disclosure use an offset to shift the order of the ciphertext corresponding to the plaintext, thereby encrypting the mapping relationship and increasing the security of the verification code.
[0134] Figure 3 This is a flow chart of the verification code generation method provided in the embodiment of the present application. Figure 3 As shown, the embodiment of the present application provides a verification code generation method, and the execution subject provided by the embodiment of the present application can be Figure 1 The audit terminal in the describes the method in detail as follows:
[0135] S301: Acquire the start time, effective duration, identifier of the operated terminal, and operation type of the operation.
[0136] In this step, the starting time of the operation, the effective duration, the identifier of the operated terminal and the operation type may be included in the operation application sent by the applicant's application terminal, or may be input by the reviewer.
[0137] The starting time may be the time at which the operation can be performed, the valid time may be the valid time of the verification code or the time from the starting time to the time when the operation cannot be performed, and the identification of the operated terminal may be the code of the operated terminal, the name of the operated terminal, etc.
[0138] S302: Concatenate the start time and the effective duration to obtain a time feature.
[0139] In this step, for example, if the starting time is May 4, 2025, represented as 250504, and the valid duration is 7 days, represented as 07, the starting time and the valid duration are concatenated to obtain the time feature 25050407. For another example, if the starting time is February 2, 2023, represented as 230202, and the valid duration is 3 days, represented as 03, the starting time and the valid duration are concatenated to obtain the time feature 23020203.
[0140] S303: Determine a mapping table to be used according to the identifier of the operated terminal.
[0141] This step is similar to the above step S204 and will not be repeated here.
[0142] S304: Map the time feature into a shortened time feature using the mapping table to be used.
[0143] In this step, the mapping table to be used is used to map every two digits in the time feature into one character to obtain a shortened time feature.
[0144] S305: Concatenate the operation type, the preset character string, and the identifier of the operated terminal to obtain a combined character string.
[0145] In this step, the preset character string may correspond to the identification of the operated terminal and be pre-stored in the audit terminal, or may be pre-set by the staff.
[0146] Among them, the operation type includes BIOS upgrade, system upgrade, port change, etc.
[0147] For example, if the operation type is "BIOS upgrade," the preset string is "ryalii," and the identifier of the operated terminal is "5ATS1268," the resulting string would be "BIOS upgrade ryalii5ATS1268." Another example is if the operation type is "port change," the preset string is "suoab," and the identifier of the operated terminal is "FWQ30021," the resulting string would be "port change suoabFWQ30021."
[0148] S306: Determine a simplified character string based on the combined character string and the time feature.
[0149] In this step, the hash value of the combined string is calculated, and the reading position is determined according to the year, month, day, and effective duration in the time feature. The characters corresponding to the reading position in the hash value of the combined string are read and concatenated to obtain a simplified string.
[0150] Among them, the reading position is determined according to the year, month, day, and effective duration in the time characteristics, which may include directly using the year, month, day, and effective duration as the reading position, or using the remainder of the year, month, day, effective duration and a preset value (the length of the hash value) as the reading position.
[0151] For example, the hash value of the combined string is "d6d8f1308ef9e86ad87333c77e864c06", and the year, month, day, and effective duration in the time feature are 25, 2, 18, and 10, respectively. Then, the 25th bit (7), the 2nd bit (6), the 18th bit (8), and the 10th bit (e) of the hash value of the combined string are read, and the result is 768e to obtain the simplified string.
[0152] S307: Concatenate the simplified character string, the time feature, and the shortened time feature to obtain a concatenated character string.
[0153] In this step, if the simplified string is "763k" and the time feature is "25070302", and the time feature is shortened to "23e", the concatenated string is "763k2507030223e". For another example, if the simplified string is "93L6" and the time feature is "25010603", and the time feature is shortened to "89j", the concatenated string is "93L62501060389j".
[0154] S308: Calculate the characteristic value of the concatenated character string using the second hash function to obtain a combined characteristic value.
[0155] In this step, the second hash function is, for example, SHA256, MD5, etc.
[0156] S309: Calculate the remainder of the effective duration using the first preset value as a divisor to obtain a duration remainder.
[0157] In this step, the first preset value may be a value calibrated by a staff according to experimental data, or may be the length of the concatenated character string calculated by the second hash function.
[0158] For example, if the effective duration is 7 and the first preset value is 32, the duration remainder is 7. For another example, if the effective duration is 20 and the first preset value is 16, the duration remainder is 4.
[0159] S310: The verification code is obtained by combining the value of the position of the duration remainder in the combined feature value, the simplified character string, and the shortened time feature.
[0160] In this step, for example, if the combined feature value is "a9c005797df244eab0d8aa1c2ae96214" and the duration remainder is 7, then the first character of the combined feature value is the 0th position, and counting to the 7th position, the value of the position of the duration remainder in the combined feature value is "9", which is spliced with the simplified character string "e01" and the shortened time feature "1cbe" to obtain the verification code "9e011cbe".
[0161] From the description of the above embodiments, it can be seen that the embodiments of the present disclosure can generate a verification code by combining the time range of the operated terminal, the identification of the operated terminal and the operation type, so that when performing verification code verification, it is possible to verify whether it is within the allowed time range of the operation and whether it is a correct operation without having to connect to the Internet. In the process of generating the verification code, the time feature is mapped using a mapping table to obtain a shortened time feature, which reduces the length of the verification code and thus reduces the possibility of errors when entering the verification code. In the process of generating the verification code, the combined feature value of the spliced character string is also calculated, and the value is extracted from the combined feature value according to the effective time length to realize encryption of the verification code generation process, so that the verification code has anti-cracking characteristics and increases the security of the verification code.
[0162] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0163] Figure 4 This is a schematic diagram of the structure of the verification code verification device provided in the embodiment of the present application. Figure 4 As shown, an embodiment of the present application further provides a verification code verification device 400, comprising:
[0164] The type determination module 401 is configured to determine the type of the operation to be verified if an operation to be verified is detected;
[0165] Parameter acquisition module 402, used to obtain the verification code to be verified, the terminal identifier to be verified and the current time;
[0166] The feature determination module 403 is configured to determine the last K digits of the verification code to be verified as the shortened time feature to be verified, where K is a positive integer;
[0167] A table determination module 404 is configured to determine a reverse mapping table according to the terminal identifier to be verified;
[0168] A reverse mapping module 405 is configured to reversely map the shortened time feature to be verified into the time feature to be verified using a reverse mapping table;
[0169] The information output module 406 is used to output a time error message if the current time is outside the range corresponding to the time feature to be verified;
[0170] The character combination module 407 is used to combine the operation type to be verified, the preset character string and the terminal identifier to be verified to obtain a combined field;
[0171] The characteristic value calculation module 408 is used to calculate the characteristic value of the spliced field;
[0172] The character string determination module 409 is used to determine the target character string based on the time feature to be verified and the feature value of the splicing field;
[0173] The information output module 406 is used to output a prompt message indicating that the operated terminal is inconsistent if the preset position of the verification code to be verified is different from the target character string;
[0174] The feature value calculation module 410 is further used to combine the target character string, the time feature to be verified, and the shortened time feature to be verified, and calculate the feature value to obtain the combined feature value to be verified;
[0175] A remainder calculation module 411 is configured to calculate the remainder of the last two digits of the time feature to be verified using a first preset value as a divisor to obtain a target remainder;
[0176] The information output module 406 is used to output a prompt indicating that the verification code is illegal and intercept the verification operation if the character at the position of the target remainder in the combined characteristic value to be verified is different from the first character of the verification code to be verified.
[0177] In a possible implementation, the string determination module 409 is configured to calculate a first characteristic value of the concatenated field using a first hash function; input the time feature to be verified and the first characteristic value into a multi-dimensional dynamic hash mapping algorithm to obtain a target string.
[0178] In one possible implementation, the string determination module 409 is used to split the time feature to be verified to obtain the year, month, day and effective duration; perform an XOR operation on the year and month in binary format to obtain a first binary value; shift the first binary value left by three bits, fill the low bit with 0, and obtain a second binary value; convert the second binary value into decimal to obtain a first salt value; add the day and the effective duration, and then multiply it by the month to obtain a second salt value; determine the first coordinate, the second coordinate and the third coordinate based on the first salt value, the second salt value and the first characteristic value; and combine the three characters corresponding to the first coordinate, the second coordinate and the third coordinate in the first characteristic value into a target string.
[0179] In one possible implementation, the string determination module 409 is configured to perform an OR operation on the lower N bits of the first salt value and the lower N bits of the second salt value shifted right by M bits to obtain a sum of the salt values, where M and N are positive integers; calculate the remainder of the sum of the salt values and the second salt value using the second preset value as a divisor to determine the first coordinate; calculate the remainder of the first salt value using the second preset value as a divisor to obtain a cut-off coordinate; divide the first eigenvalue into a first part and a second part from the cut-off coordinate; reverse the order of the first part and the second part and then splice them to obtain a flipped string; calculate the second eigenvalue using the second preset value as a divisor The target character position is obtained by converting the character of the target character position in the flipped string into a preset format to obtain the target character value; performing an XOR operation on the second binary salt value and the binary target character value to obtain the remainder operation value; using the second preset value as the divisor, calculating the remainder of the remainder operation value to obtain the second coordinate; the target character position of the first eigenvalue is moved to the X position after the target character position to obtain a hash window string; converting each bit in the hash window string to a numerical value and adding them to obtain a window value; using the second preset value as the divisor, calculating the remainder of the window value to obtain the third coordinate.
[0180] In one possible implementation, the table determination module 404 is used to use a second hash function to calculate a second characteristic value of the terminal identifier to be verified, where the second characteristic value is composed of K digits, where K is a positive integer; the K digits are added and then the remainder is taken with a third preset value as a divisor to obtain an offset; according to the offset, the mapping relationship of the preset mapping table is changed to obtain a reverse mapping table.
[0181] In a possible implementation, a preset mapping table is composed of plaintext and corresponding ciphertext. The table determination module 404 is configured to shift the ciphertext corresponding to each plaintext in the preset mapping table by an offset to obtain a reverse mapping table.
[0182] Figure 5 This is a schematic diagram of the structure of the verification code generation device provided in the embodiment of the present application. Figure 5As shown, the verification code generating device 500 includes: a data acquisition module 501, a time splicing module 502, a mapping table determination module 503, a time mapping module 504, a first splicing module 505, a character simplification module 506, a second splicing module 507, a feature calculation module 508, a remainder calculation module 509 and a verification code splicing module 510.
[0183] The data acquisition module 501 is used to acquire the start time, effective duration, identifier of the operated terminal and operation type of the operation.
[0184] The time splicing module 502 is used to splice the start time and the effective duration to obtain a time feature.
[0185] The mapping table determination module 503 is configured to determine a mapping table to be used according to the identifier of the operated terminal.
[0186] The time mapping module 504 is configured to map the time feature into a shortened time feature using a to-be-used mapping table.
[0187] The first concatenation module 505 is configured to concatenate the operation type, the preset character string, and the identifier of the operated terminal to obtain a combined character string.
[0188] The character simplification module 506 is configured to determine a simplified character string based on the combined character string and the time feature.
[0189] The second concatenation module 507 is configured to concatenate the simplified character string, the time feature, and the shortened time feature to obtain a concatenated character string.
[0190] The feature calculation module 508 is configured to calculate the feature value of the concatenated character string using a second hash function to obtain a combined feature value.
[0191] The remainder calculation module 509 is configured to calculate the remainder of the effective duration using the first preset value as a divisor to obtain a duration remainder.
[0192] The verification code splicing module 510 is used to obtain a verification code by splicing the value of the position of the duration remainder in the combined feature value, simplifying the character string and shortening the time feature.
[0193] Figure 6 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 6 As shown, the electronic device 60 provided in this embodiment includes: at least one processor 601 and a memory 602. Optionally, the electronic device 60 further includes a communication component 603. The processor 601, the memory 602 and the communication component 603 are connected via a bus.
[0194] During the specific implementation process, at least one processor 601 executes the computer-executable instructions stored in the memory 602, so that the at least one processor 601 executes the above-mentioned verification code generation method or verification code verification method embodiment.
[0195] The specific implementation process of the processor 601 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0196] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the application may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.
[0197] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0198] A bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0199] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above-mentioned XX method embodiments when run.
[0200] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0201] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any one of the above-mentioned XX method embodiments are implemented.
[0202] An embodiment of the present application further provides another computer program product, comprising a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps in any of the above-mentioned verification code generation methods or verification code verification method embodiments.
[0203] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0204] The above is a detailed introduction to the generation and verification method, device, equipment and storage medium of a verification code provided by this application. Specific examples are used herein to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
Claims
1. A verification code verification method, characterized in that: include: If an operation to be verified is detected, determining the type of operation to be verified of the operation to be verified; Obtain the verification code to be verified, the terminal identifier to be verified, and the current time; Determine the last K digits of the verification code to be verified as the shortened time feature to be verified, where K is a positive integer; Determine a reverse mapping table according to the terminal identifier to be verified; wherein the reverse mapping table is obtained by changing a mapping relationship of a preset mapping table, and the preset mapping table is composed of plaintext and corresponding ciphertext; Reversely mapping the shortened time feature to be verified into a time feature to be verified using the reverse mapping table; If the current time is outside the range corresponding to the time feature to be verified, output a time error message; If the current time is within the range corresponding to the time feature to be verified, concatenating the operation type to be verified, the preset character string, and the terminal identifier to be verified to obtain a concatenated field; Calculating the characteristic value of the spliced field; Determining a target character string according to the time feature to be verified and the characteristic value of the splicing field; If the preset position of the verification code to be verified is different from the target character string, outputting a prompt message indicating that the operated terminal is inconsistent; If the preset position of the verification code to be verified is the same as the target character string, then concatenating the target character string, the time feature to be verified, and the shortened time feature to be verified, and calculating a feature value to obtain a combined feature value to be verified; Using the first preset value as a divisor, calculating the remainder of the last two digits of the time feature to be verified to obtain a target remainder; If the character at the position of the target remainder in the combined characteristic value to be verified is different from the first character of the verification code to be verified, a prompt indicating that the verification code is illegal is output, and the verification operation to be verified is intercepted.
2. The method according to claim 1, characterized in that The determining of the target character string according to the time feature to be verified and the characteristic value of the splicing field includes: Calculating a first characteristic value of the concatenated field using a first hash function; The time feature to be verified and the first feature value are input into a multi-dimensional dynamic hash mapping algorithm to obtain a target character string.
3. The method according to claim 2, characterized in that The step of inputting the time feature to be verified and the first feature value into a multi-dimensional dynamic hash mapping algorithm to obtain a target character string includes: Split the time feature to be verified into year, month, day and validity period; Performing an XOR operation on the year and the month in binary format to obtain a first binary value; Shift the first binary value left by three bits and fill the low bits with 0 to obtain a second binary value; Convert the second binary value into decimal to obtain a first salt value; Add the day and the effective duration, and multiply the sum by the month to obtain a second salt value; Determining a first coordinate, a second coordinate, and a third coordinate according to the first salt value, the second salt value, and the first characteristic value; The three characters corresponding to the first coordinate, the second coordinate, and the third coordinate in the first feature value are combined into a target character string.
4. The method according to claim 3, characterized in that The determining of the first coordinate, the second coordinate, and the third coordinate according to the first salt value, the second salt value, and the first characteristic value includes: Perform an OR operation on the lower N bits of the first salt value and the lower N bits of the second salt value shifted right by M bits to obtain a sum of the salt values, where M and N are positive integers; Using a second preset value as a divisor, calculating a remainder of the sum of the salt value sum and the second salt value, and determining the remainder as the first coordinate; Using the second preset value as a divisor, calculating the remainder of the first salt value to obtain a cut-off coordinate; dividing the first eigenvalue into a first part and a second part from the cut-off coordinate; Reversing the order of the first part and the second part and then concatenating them to obtain a reversed string; Using the second preset value as a divisor, calculating the remainder of the second salt value to obtain the target character position; Convert the target character position in the reversed character string into a preset format to obtain a target character value; Performing an XOR operation on the second binary salt value and the target binary character value to obtain a remainder operation value; Using a second preset value as a divisor, calculating the remainder of the remainder operation value to obtain the second coordinate; Read the characters from the target character position to the X positions after the target character position of the first feature value to obtain a hash window character string; Convert each bit in the hash window string into a numerical value and add them together to obtain a window value; The second preset value is used as a divisor to calculate the remainder of the window value to obtain the third coordinate.
5. The method according to any one of claims 1 to 4, characterized in that The determining of the reverse mapping table according to the terminal identifier to be verified includes: Using a second hash function, calculating a second characteristic value of the terminal identifier to be verified, wherein the second characteristic value consists of K digits, where K is a positive integer; Add the K numbers and then take the remainder with the third preset value as the divisor to obtain an offset; According to the offset, the mapping relationship of the preset mapping table is changed to obtain a reverse mapping table.
6. The method according to claim 5, characterized in that The step of changing the mapping relationship of a preset mapping table according to the offset to obtain a reverse mapping table includes: The ciphertext corresponding to each plaintext in the preset mapping table is shifted by the position of the offset to obtain a reverse mapping table.
7. A verification code generation method, characterized in that: include: Obtain the start time, validity duration, identifier of the operated terminal, and operation type of the operation; Concatenate the starting time and the effective duration to obtain a time feature; determining a mapping table to be used according to the identifier of the operated terminal; Mapping the time feature into a shortened time feature using the to-be-used mapping table; Concatenating the operation type, the preset character string, and the identifier of the operated terminal to obtain a combined character string; determining a simplified character string according to the combined character string and the time feature; splicing the simplified character string, the time feature, and the shortened time feature to obtain a spliced character string; Calculating the characteristic value of the concatenated character string using a second hash function to obtain a combined characteristic value; Using the first preset value as a divisor, calculating the remainder of the effective duration to obtain a duration remainder; The verification code is obtained by splicing the value of the position of the duration remainder in the combined feature value, the simplified character string and the shortened time feature.
8. A verification code verification device, characterized in that: include: a type determination module, configured to determine a type of the operation to be verified if an operation to be verified is detected; The parameter acquisition module is used to obtain the verification code to be verified, the terminal identification to be verified and the current time; a feature determination module, configured to determine the last K digits of the verification code to be verified as a shortened time feature to be verified, where K is a positive integer; a table determination module, configured to determine a reverse mapping table according to the terminal identifier to be verified; wherein the reverse mapping table is obtained by changing a mapping relationship of a preset mapping table, the preset mapping table consisting of plaintext and corresponding ciphertext; a reverse mapping module, configured to reversely map the shortened time feature to be verified into a time feature to be verified using the reverse mapping table; An information output module, configured to output a time error message if the current time is outside the range corresponding to the time feature to be verified; a character combination module, configured to, if the current moment is within a range corresponding to the time feature to be verified, concatenate the operation type to be verified, a preset character string, and the terminal identifier to be verified to obtain a concatenated field; A characteristic value calculation module, used for calculating the characteristic value of the spliced field; A character string determination module, configured to determine a target character string based on the time feature to be verified and the characteristic value of the splicing field; The information output module is further configured to output a prompt message indicating that the operated terminal is inconsistent if the preset position of the verification code to be verified is different from the target character string; The feature value calculation module is further configured to, if the preset position of the verification code to be verified is the same as the target character string, concatenate the target character string, the time feature to be verified, and the shortened time feature to be verified, and calculate the feature value to obtain the combined feature value to be verified; A remainder calculation module, configured to calculate the remainder of the last two digits of the time feature to be verified using a first preset value as a divisor to obtain a target remainder; The information output module is used to output a prompt indicating that the verification code is illegal and intercept the verification operation if the character at the position of the target remainder in the combination characteristic value to be verified is different from the first character of the verification code to be verified.
9. A verification code generating device, characterized in that: include: The data acquisition module is used to obtain the start time, effective duration, identification of the operated terminal and operation type of the operation; A time splicing module, configured to splice the start time and the effective duration to obtain a time feature; a mapping table determination module, configured to determine a mapping table to be used according to an identification of the operated terminal; a time mapping module, configured to map the time feature into a shortened time feature using the to-be-used mapping table; A first concatenation module is configured to concatenate the operation type, the preset character string, and the identifier of the operated terminal to obtain a combined character string; a character simplification module, configured to determine a simplified character string based on the combined character string and the time feature; A second concatenation module is configured to concatenate the simplified character string, the time feature, and the shortened time feature to obtain a concatenated character string; a feature calculation module, configured to calculate a feature value of the concatenated character string using a second hash function to obtain a combined feature value; A remainder calculation module, configured to calculate the remainder of the effective duration using a first preset value as a divisor to obtain a duration remainder; The verification code splicing module is used to splice the value of the position of the duration remainder in the combined feature value, the simplified character string and the shortened time feature to obtain a verification code.
10. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the verification code verification method according to any one of claims 1 to 6 or the verification code generation method according to claim 7 when executing the computer program.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the verification code verification method according to any one of claims 1 to 6 or the verification code generation method according to claim 7 are implemented.
Citation Information
Patent Citations
Watermark encryption method and device, medium and electronic device
CN108985081A
Password generation method, offline password verification method, electronic equipment and storage medium
CN115883083A