CN112487253B - User invitation code generation method, verification method, device, equipment and storage medium - Google Patents

User invitation code generation method, verification method, device, equipment and storage medium Download PDF

Info

Publication number
CN112487253B
CN112487253B CN202011209419.XA CN202011209419A CN112487253B CN 112487253 B CN112487253 B CN 112487253B CN 202011209419 A CN202011209419 A CN 202011209419A CN 112487253 B CN112487253 B CN 112487253B
Authority
CN
China
Prior art keywords
invitation code
user
user invitation
code
array
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
CN202011209419.XA
Other languages
Chinese (zh)
Other versions
CN112487253A (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.)
Guangrui Technology Shenzhen Co ltd
Original Assignee
Guangrui Technology Shenzhen Co 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 Guangrui Technology Shenzhen Co ltd filed Critical Guangrui Technology Shenzhen Co ltd
Priority to CN202011209419.XA priority Critical patent/CN112487253B/en
Publication of CN112487253A publication Critical patent/CN112487253A/en
Application granted granted Critical
Publication of CN112487253B publication Critical patent/CN112487253B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • 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
    • H04L9/0866Generation of secret information including derivation or calculation of cryptographic keys or passwords involving user or device identifiers, e.g. serial number, physical or biometrical information, DNA, hand-signature or measurable physical characteristics

Abstract

The present invention relates to the field of information technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a user invitation code. The user invitation code generation method comprises the following steps: requesting to acquire a user invitation code interface and acquiring a current user id; generating a user invitation code id, newly generating and storing a user invitation code record in a database, wherein the record information comprises the user id, the user invitation code id and the validity period of the user invitation code; combining the user id and the user invitation code id to generate a first invitation code id; and diffusing and confusing the first invitation code id through a preset algorithm to obtain a second invitation code id. The user invitation code generated by the method is short and unique and can not be repeated. The method is based on the cryptography technology of diffusion and confusion, the key space is large, the generated user invitation code is irregular and can be circulated, and is difficult to crack, and the safety is high; the user invitation code comprises validity period information, and is applicable to a scene requiring a temporary invitation code.

Description

User invitation code generation method, verification method, device, equipment and storage medium
Technical Field
The present invention relates to the field of information technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a user invitation code.
Background
Currently, many mobile applications have a registration invitation mechanism to trace back to the inviter to dispense the corresponding rewards. The core of the invitation mechanism is an invitation code, and the characteristics of the invitation code comprise unique identification for distinguishing different individuals, short length and capability of tracing back to corresponding individuals. The current generation method of the invitation code comprises random generation, hash value taking based on MD5, binary conversion and the like.
Currently, the conventional technical scheme comprises a method for generating and splicing identification codes and verification codes based on MD 5. The technical scheme based on MD5 is that an MD5 algorithm is used for generating a hash array for the reference identification code, then the hash array is converted into a verification character string, position transformation is carried out on the hash array, a target character string is generated, and finally the verification character string and the target character string are spliced. Due to the characteristics of the MD5, the probability of collision is increased, and most of the MD5 information needs to be discarded in the process of generating the hash array, so that the length of the invitation code to be generated is reduced, and the probability of collision of the invitation code is increased. In addition, the technical scheme of splicing and generating the characteristic value and the identification code is adopted, wherein the technical scheme is that a first redundancy check code and a second redundancy check code are obtained through generation and conversion based on a random character string, a database main key identification and a secret key, and then an invitation code is generated through splicing of the first redundancy check code, the database main key identifier and the second redundancy check code. The method finally uses a mode of splicing the check code and the database primary key identifier to generate the invitation code, so that the generated invitation code is similar and is easy to attack and crack other invitation codes by using a guessing and brute force method by a hacker, and the security is not high.
Disclosure of Invention
The object of the present application is to solve the above-mentioned technical problems at least to some extent.
Therefore, the first aspect of the present application proposes a method for generating a user invitation code, which is based on cryptography and mathematical theory, and performs operations of bit diffusion, confusion and encryption on a unique identifier of a user in the process of generating the user invitation code, so as to solve the problems of conflict and easy cracking of the invitation code.
A second aspect of the present application proposes a user invitation verification method.
A third aspect of the present application proposes a user invitation code generating apparatus.
A fourth aspect of the present application proposes a user invitation verification apparatus.
A fifth aspect of the present application proposes an apparatus.
A sixth aspect of the present application proposes a computer readable storage medium.
A seventh aspect of the present application proposes another apparatus.
An eighth aspect of the present application proposes another computer-readable storage medium.
The specific scheme of the application is as follows:
in a first aspect, the present application proposes a method for generating a user invitation code, which specifically includes:
a user invitation code generation method, the method comprising:
requesting to acquire a user invitation code interface and acquiring a current user id;
generating a user invitation code id, newly generating and storing a user invitation code record in a database, wherein the record information comprises the user id, the user invitation code id and the validity period of the user invitation code;
combining the user id and the user invitation code id to generate a first invitation code id;
diffusing and confusing the first invitation code id through a preset algorithm to obtain a second invitation code id;
carrying out binary conversion and check bit calculation on the second invitation code id through a preset rule to obtain a first array;
and carrying out position mapping on the first array and combining to obtain a user invitation code.
Further, the specific process of mapping the position of the first array and combining to obtain the user invitation code is as follows: defining a character space, wherein each character is unique in space and random in position, finding out the corresponding character in the character string by taking the character as an index according to each numerical value in the first array, and finally combining each obtained character to obtain the user invitation code.
Further, converting the first invitation code id into a two-dimensional matrix, and performing column displacement and row displacement on the two-dimensional matrix according to a preset algorithm; and converting the two-dimensional matrix after the shift into an integer invitation code id, randomly generating a key byte array by the system, and performing exclusive or calculation on the integer invitation code id to obtain a second invitation code id.
In a second aspect, the present application proposes a user invitation code verification method, which specifically includes:
a user invitation verification method, the method comprising:
receiving a user invitation code input by a user;
disassembling and mapping the user invitation code to obtain a second array;
checking check bits of the second group according to a preset rule, and if the check is not passed, invalidating the user invitation code; if the check passes, carrying out the binary conversion on the second number group to obtain a third invitation code id;
analyzing the third invitation code id, and performing confusion inverse operation and diffusion inverse operation on the third invitation code id according to a preset algorithm to obtain a fourth invitation code id;
splitting the fourth invitation code id into a first user id and a first user invitation code id; searching a user invitation code record corresponding to a first user id and the first user invitation code id from the user invitation code record pre-stored in the database; wherein the user invitation code record is generated by using the user invitation code generation method of the first aspect; if the corresponding user invitation code record exists and is still in the validity period currently, the validity of the user invitation code is verified, otherwise, the user invitation code is invalid, and the verification is not passed.
Further, the third invitation code id is analyzed, and the confusion inverse operation and the diffusion inverse operation are carried out on the third invitation code id according to a preset algorithm, so that the specific method for obtaining the fourth invitation code id is as follows: performing exclusive or decryption calculation on the third invitation code id by using a key byte array generated when the user invitation code is generated in the first aspect to obtain a first integer invitation code id; and converting the first integer invitation code id into a two-dimensional matrix, performing column and row inverse displacement on the two-dimensional matrix according to a preset algorithm, and converting the two-dimensional matrix after the inverse displacement into a fourth invitation code id.
Further, the specific method for disassembling and mapping the user invitation code to obtain the second array comprises the following steps: and disassembling the character string of the user invitation code into a plurality of characters, using the character space defined when the user invitation code is generated in the first aspect, searching each character in the defined character space, and combining indexes of the characters in the character space according to the character sequence in the character string to obtain a second group.
In a third aspect, the present application proposes a user invitation code generating device, which specifically includes:
a user invitation code generating apparatus comprising:
the user id acquisition module is used for requesting to acquire a user invitation code interface and acquiring the current user id;
the user invitation code id generation module is used for generating a user invitation code id;
the user invitation code record generation module is used for newly generating a user invitation code record in the database, wherein the record information comprises the user id, the user invitation code id and the validity period of the user invitation code;
the data storage module is used for storing the newly generated user invitation code record in the database;
a first invitation code id generation module, configured to combine the user id and the user invitation code id to generate a first invitation code id;
the second invitation code id generation module is used for diffusing and confusing the first invitation code id through a preset algorithm to obtain a second invitation code id;
the first array generation module is used for carrying out binary conversion and check bit calculation on the second invitation code id through a preset rule to obtain a first array;
and the invitation code generation module is used for carrying out position mapping on the first array and combining the first array to obtain a user invitation code.
In a fourth aspect, the present application proposes a user invitation code verification apparatus, which specifically includes:
a user invitation code verification apparatus, comprising:
the invitation code receiving module is used for receiving a user invitation code input by a user;
the disassembly and mapping module is used for disassembling and mapping the user invitation code to obtain a second array;
the check bit module is used for checking check bits of the second number group according to a preset rule; if the verification is not passed, the user invitation code is invalid;
the system conversion module is used for carrying out system conversion on the second number group after checking to obtain a third invitation code id;
the analysis module is used for carrying out confusion inverse operation and diffusion inverse operation on the third invitation code id according to a preset algorithm to obtain a fourth invitation code id;
the splitting module is used for splitting the fourth invitation code id into a first user id and a first user invitation code id;
the verification module is used for searching the user invitation code records corresponding to the first user id and the first user invitation code id from the user invitation code records pre-stored in the database; wherein the user invitation code record is generated by using the user invitation code generating means described in the third aspect; if the corresponding user invitation code record exists and is still in the validity period currently, the validity of the user invitation code is verified, otherwise, the user invitation code is invalid, and the verification is not passed.
In a fifth aspect, the present application proposes an apparatus, as follows:
an apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the user invitation code generation method of any one of the first aspects when the computer program is executed.
In a sixth aspect, the present application proposes a computer readable storage medium, which specifically includes:
a computer readable storage medium storing a computer program which when executed by a processor implements the steps of the user invitation code generation method of any one of the above first aspects.
In a seventh aspect, the present application proposes an apparatus, as follows:
an apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the user invitation code verification method of any one of the second aspects when the computer program is executed.
In an eighth aspect, the present application proposes a computer readable storage medium, which specifically includes:
a computer readable storage medium storing a computer program which when executed by a processor implements the steps of the user invitation code verification method of any one of the above second aspects.
The beneficial effects of this application:
(1) Compared with the MD 5-based scheme, the generated user invitation code is short and unique, and can be ensured not to be repeated.
(2) Based on the cryptography technology of diffusion and confusion, the key space is large, the generated user invitation code is irregular and can be circulated, and is difficult to crack, so that the safety is ensured.
(3) The generated user invitation code contains validity period information and can be suitable for a scene requiring the temporary invitation code.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following description will briefly introduce the drawings that are needed in the embodiments or the description of the prior art, it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for generating a user invitation code according to an embodiment of the present application;
fig. 2 is a flowchart of a user invitation code verification method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a user invitation code generating device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a user invitation code verification device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
In addition, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The user invitation code generation method and the user invitation code verification method provided by the embodiment of the application can be applied to terminal equipment such as a mobile terminal, a desktop computer, a notebook computer, a palm computer, a cloud server and the like, and can be specifically realized through an operating application program (APP or other systems) in the terminal equipment.
As shown in fig. 1, a flowchart of a method for generating a user invitation code according to an embodiment of the first aspect of the present application is provided, by way of example and not limitation, and the method includes:
the client requests to acquire a user invitation code interface and acquires a current user initial identifier;
because the initial identifier and the user invitation code to be generated are in one-to-one relation, the uniqueness of the user initial identifier needs to be ensured when the user initial identifier is acquired, in the embodiment of the application, the user invitation code and the user are in one-to-one correspondence, and therefore, a 32-bit integer user id (User Identification ) is directly taken as the initial identifier, and only the current 32-bit integer user id is required to be directly acquired, wherein the 32-bit integer user id is generated by a system through a database id self-increasing mode when the user registers an account, and the 32-bit integer user id is unique for each user.
Specifically, when the client acquires the user id of the 32-bit integer, if the user does not exist, prompting the user to register an account, and generating the user id of the 32-bit integer by the system in a database id self-increasing mode.
After obtaining the user id of the 32-bit integer, generating the user invitation code id of the 32-bit integer according to the user id of the 32-bit integer, and newly generating and storing a user invitation code record in a database, wherein the record information comprises the user id of the 32-bit integer, the user invitation code id of the 32-bit integer and the validity period of the user invitation code.
And combining the 32-bit integer user id and the 32-bit integer user invitation code id to generate a first invitation code id. In particular, the method of combining in the embodiments of the present application may be: the first invitation code id of 64-bit integer is combined in a way that the user id of 32-bit integer is high and the user invitation code id of 32-bit integer is low. The combination method is not particularly limited herein.
Specifically, after obtaining the first invitation code id of 64-bit integer, the first invitation code id of 64-bit integer is diffused and confused by a preset algorithm to obtain the second invitation code id of 64-bit integer, wherein the confusion refers to an encryption operation that makes the relation between a secret key and a ciphertext as fuzzy as possible, and the diffusion refers to an encryption operation that diffuses the influence of one plaintext symbol to a plurality of ciphertext symbols in order to hide the statistical characteristics of plaintext. In this embodiment of the present application, the specific method for performing diffusion and confusion through a preset algorithm may be: converting the first invitation code id of 64-bit integer into an 8×8 two-dimensional matrix, and performing row shift and row shift according to the rule that matrix [ i ] [ j ] = matrix [ i x P1%8] [ j x P2%8], wherein parameters i and j represent indexes of rows and columns respectively, and parameters P1 and P2 are two different positive integers and are mutually equal to integer 8; after the shift is completed, the two-dimensional matrix is converted into the invitation code id of the 64-bit integer again, and the diffusion of the first invitation code id of the 64-bit integer is completed. Then, the system randomly generates a 64-bit key byte array, and uses the key byte array to exclusive-or the 64-bit integer invitation code id to obtain a confused second invitation code id (still 64 bits). Thus, the diffusion and confusion of the first invitation code id of the 64-bit integer is completed.
After the diffusion and confusion of the first invitation code id of the 64-bit integer are completed, carrying out the binary conversion and the calculation of check bits on the second invitation code id of the 64-bit integer through a preset rule to obtain a first array.
Specifically, the specific method for performing the binary conversion and the check bit calculation on the 64-bit integer second invitation code id through a preset rule to obtain the first array may be: generating an integer array with a length of 6 bits (setting the length of the user invitation code in the embodiment of the application to be 6 bits), assigning a second invitation code id of 64-bit integer to the first bit of the integer array, then performing 64-system conversion operation, performing conversion to only the first 5 bits of the array, and leaving the last bit as a check bit, wherein the method specifically comprises the following steps: the next digit value of the integer array is equal to the current digit value divided by the integer 64, the integer array current digit takes the remainder from the integer 64, the remainder is reassigned to the integer array current digit, and so on to complete the digit conversion operation of the first 5 digits of the array. As for the specific method for calculating the check bit, it may be: the first 5 digits of the integer array after the completion of the binary conversion are accumulated, the sum obtained is multiplied by a prime number P3 (P3 and an integer 64 are mutually prime), the remainder is taken from the integer 64 to obtain a check value, and the check value is stored in the last digit of the integer array. Thus, a complete first array of 6-bit numbers is obtained after the binary conversion and the calculation of check bits.
Specifically, after obtaining a first array, performing position mapping on the first array and combining to obtain a user invitation code. In the embodiment of the present application, a specific method may be to define a character space with a length of 64, where each character is unique in space and random in location, find a corresponding character in a character string in the character space according to each numerical value in the first array as an index, and finally combine each obtained character to obtain the user invitation code.
Finally, the user invitation code is updated and returned to the user interface. And updating the generated user invitation code into a user invitation code record corresponding to the database, and simultaneously returning the user invitation code to the client. Thus, the method for generating the user invitation code in the embodiment of the application is completed.
The user invitation code generated by the method is short and unique, and can be ensured not to be repeated compared with the scheme based on MD 5. Based on the cryptography technology of diffusion and confusion, the key space is large, the generated user invitation code is irregular and can be circulated, and is difficult to crack, so that the safety is ensured. In addition, the user invitation code generated by the method comprises validity period information, and the method can be suitable for scenes with requirements on temporary invitation codes.
As shown in fig. 2, an embodiment of the second aspect of the present application provides a user invitation code verification method, which corresponds to the user invitation code generation method of the embodiment of the first aspect. By way of example, and not limitation, the method includes:
receiving a user invitation code input by a user; in the embodiment of the application, the length of the user invitation code is set to be 6 characters; these characters may be numbers, letters, etc., such as 1, 2, 3, A, B, C, etc.
Disassembling and mapping the user invitation code to obtain a second array;
specifically, the specific method of disassembly and location mapping may be: disassembling a character string of the user invitation code into 6 characters, using a character space with the length of 64 defined when the embodiment of the first aspect of the application is used for generating the user invitation code, searching each character in the defined character space with the length of 64, and forming a second array with the length of 6 by indexes of the characters in the character space according to the character sequence in the character string.
Specifically, after the second group is obtained, checking check bits are performed on the second group according to a preset rule, and if the check is not passed, the user invitation code is invalid; if the check passes, carrying out the binary conversion on the second number group to obtain a third invitation code id; in the embodiment of the present application, a specific method for checking check bits may be: accumulating the first 5 digits of the second array, multiplying the sum by a prime number P3 (P3 is the prime number of the integer 64), taking the remainder from the integer 64 to obtain a calculated check value, comparing the calculated check value with the last digit of the second array, if the calculated check value and the last digit are unequal, failing to verify, and invalidating the user invitation code; otherwise, checking is passed, and the next flow is entered. In the embodiment of the present application, the specific method for binary conversion may be: and converting the integer of the first 5 bits of the second array, calculating from the 5 th bit onward, adding the product of the value of the previous bit and the integer 64 to the value of each bit, and assigning the result to the previous bit until the calculation of the previous bit is finished when the previous bit is the first bit of the second array, thereby obtaining the third invitation code id of 64-bit integer.
After the third invitation code id is obtained, the third invitation code id is resolved: and performing confusion inverse operation and diffusion inverse operation on the third invitation code id according to a preset algorithm to obtain a fourth invitation code id with 64-bit integer.
Specifically, the third invitation code id is analyzed, and the confusion inverse operation and the diffusion inverse operation are carried out on the third invitation code id according to a preset algorithm, so that the specific method for obtaining the fourth invitation code id is as follows: using the 64-bit key byte array generated when the embodiment of the first aspect of the application generates the user invitation code, performing exclusive-or decryption calculation on the third invitation code id to obtain a first integer invitation code id; after obtaining a first integer invitation code id, converting the first integer invitation code id into a two-dimensional matrix, and performing column inverse shift and row inverse shift according to the rule of matrix [ i ] [ j ] = matrix [ i ] P1%8] [ j ] P2%8], wherein parameters i and j represent indexes of rows and columns respectively, and parameters P1 and P2 are mutually equal to integer 8; and finally, converting the two-dimensional matrix after the reverse shift is completed into a fourth invitation code id of 64-bit integer.
Splitting the fourth invitation code id into a first user id of a 32-bit integer and a first user invitation code id of a 32-bit integer; the specific splitting method can be as follows: the first user id of the 32-bit integer is the high order of the fourth invitation code id of the 64-bit integer, and the first user invitation code id of the 32-bit integer is the low order of the fourth invitation code id of the 64-bit integer.
After splitting the fourth invitation code id of the 64-bit integer, searching the user invitation code records corresponding to the first user id of the 32-bit integer and the first user invitation code id of the 32-bit integer from the user invitation code records prestored in the system database; wherein the user invitation code record is generated by using the user invitation code generation method described in the embodiment of the first aspect of the application; if the corresponding user invitation code record exists and is still in the validity period currently, the validity of the user invitation code is verified, otherwise, the user invitation code is invalid, and the verification is not passed. Thus, the user invitation code verification method of the embodiment of the application is completed.
As shown in fig. 3, an embodiment of the third aspect of the present application provides a user invitation code generating device, which corresponds to the user invitation code generating method provided by the embodiment of the first aspect of the present application, and since the user invitation code generating device provided by the embodiment of the present application corresponds to the user invitation code generating method provided by the embodiment of the first aspect of the present application, implementation of the user invitation code generating method described above is also applicable to the user invitation code generating device provided by the embodiment, and will not be described in detail in the embodiment. Fig. 3 is a schematic structural diagram of a user invitation code generating apparatus according to an embodiment of a third aspect of the present application. Comprising the following steps:
a user id obtaining module 101, configured to request to obtain a user invitation code interface, and obtain a current user id;
a user invitation code id generation module 102, configured to generate a user invitation code id;
a user invitation code record generating module 103, configured to newly generate a user invitation code record in the database, where the record information includes the user id, the user invitation code id, and the validity period of the user invitation code;
a data storage module 104, configured to store the newly generated user invitation code record in the database;
a first invitation code id generation module 105, configured to combine the user id and the user invitation code id to generate a first invitation code id;
a second invitation code id generation module 106, configured to diffuse and obfuscate the first invitation code id through a preset algorithm to obtain a second invitation code id;
a first array generating module 107, configured to perform binary conversion and check bit calculation on the second invitation code id through a preset rule to obtain a first array;
and the invitation code generating module 108 is configured to map the positions of the first arrays and combine the first arrays to obtain a user invitation code.
As shown in fig. 4, an embodiment of the fourth aspect of the present application provides a user invitation code verification apparatus, which corresponds to the user invitation code verification method provided by the embodiment of the second aspect of the present application, and since the user invitation code verification apparatus provided by the embodiment of the present application corresponds to the user invitation code verification method provided by the embodiment of the second aspect of the present application, the implementation of the user invitation code verification method described above is also applicable to the user invitation code verification apparatus provided by the embodiment, and will not be described in detail in the present embodiment. Fig. 4 is a schematic structural diagram of a user invitation code verification device according to an embodiment of a fourth aspect of the present application. Comprising the following steps:
an invitation code receiving module 201, configured to receive a user invitation code input by a user;
a disassembling and mapping module 202, configured to disassemble and map the user invitation code to obtain a second array;
the check bit module 203 is configured to check bits of the second number set according to a preset rule; if the verification is not passed, the user invitation code is invalid;
a binary conversion module 204, configured to perform binary conversion on the second set after the check is passed, so as to obtain a third invitation code id;
the parsing module 205 is configured to perform a confusion inverse operation and a diffusion inverse operation on the third invitation code id according to a preset algorithm, so as to obtain a fourth invitation code id;
a splitting module 206, configured to split the fourth invitation code id into a first user id and a first user invitation code id;
a verification module 207, configured to search, from user invitation code records pre-stored in the database, for user invitation code records corresponding to the first user id and the first user invitation code id; wherein the user invitation code record is generated by using the user invitation code generating means described in the embodiment of the third aspect described above; if the corresponding user invitation code record exists and is still in the validity period currently, the validity of the user invitation code is verified, otherwise, the user invitation code is invalid, and the verification is not passed.
An embodiment of a fifth aspect of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the user invitation code generating method according to any embodiment of the first aspect, when the processor executes the computer program.
An embodiment of a sixth aspect of the present application proposes a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the user invitation code generation method of any embodiment of the first aspect described above.
An embodiment of a seventh aspect of the present application proposes a terminal device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the user invitation code verification method according to any embodiment of the second aspect described above when the computer program is executed.
An embodiment of the eighth aspect of the present application proposes a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the user invitation code verification method according to any embodiment of the second aspect described above.
The terminal device can be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server and the like. The terminal device may also include more or fewer components, or may combine certain components, or different components, such as the terminal device may also include input and output devices, network access devices, buses, etc.
The processor may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may be an internal storage unit of the terminal device, such as a hard disk or a memory of the terminal device. The memory may also be an external storage device of the terminal device, such as a plug-in hard disk provided on the terminal device, a Smart Media Card (SMC), a secure digital (SecureDigital, SD) Card, a Flash memory Card (Flash Card), etc. Further, the memory may also include both an internal storage unit and an external storage device of the terminal device. The memory is used for storing the computer program and other programs and data required by the terminal device. The memory may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (RAM, randomAccess Memory), electrical carrier signal, telecommunications signal, and software distribution medium. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (12)

1. A method for generating a user invitation code, the method comprising:
requesting to acquire a user invitation code interface and acquiring a current user id;
generating a user invitation code id, newly generating and storing a user invitation code record in a database, wherein the record information comprises the user id, the user invitation code id and the validity period of the user invitation code;
combining the user id and the user invitation code id to generate a first invitation code id;
diffusing and confusing the first invitation code id through a preset algorithm to obtain a second invitation code id;
carrying out binary conversion and check bit calculation on the second invitation code id through a preset rule to obtain a first array;
and carrying out position mapping on the first array and combining to obtain a user invitation code.
2. The method for generating a user invitation code according to claim 1, wherein the specific process of performing location mapping on the first array and combining to obtain the user invitation code is as follows: defining a character space, wherein each character is unique in space and random in position, finding out the corresponding character in a character string in the character space by taking each character as an index according to each numerical value in the first array, and finally combining each obtained character to obtain a user invitation code, wherein the character of the character string is a number or a letter.
3. The method for generating a user invitation code according to claim 1, wherein the specific method for spreading and confusion is as follows: converting the first invitation code id into a two-dimensional matrix, and performing column shift and row shift on the two-dimensional matrix according to a preset algorithm; and converting the two-dimensional matrix after the shift into an integer invitation code id, randomly generating a key byte array by the system, and performing exclusive or calculation on the integer invitation code id to obtain a second invitation code id.
4. A method for verifying a user invitation, the method comprising:
receiving a user invitation code input by a user;
disassembling and mapping the user invitation code to obtain a second array;
checking check bits of the second group according to a preset rule, and if the check is not passed, invalidating the user invitation code; if the check passes, carrying out the binary conversion on the second number group to obtain a third invitation code id;
analyzing the third invitation code id, and performing confusion inverse operation and diffusion inverse operation on the third invitation code id according to a preset algorithm to obtain a fourth invitation code id;
splitting the fourth invitation code id into a first user id and a first user invitation code id; searching a user invitation code record corresponding to a first user id and the first user invitation code id from the user invitation code record pre-stored in the database; wherein the user invitation code record is generated by using the user invitation code generation method of claim 1; if the corresponding user invitation code record exists and is still in the validity period currently, the validity of the user invitation code is verified, otherwise, the user invitation code is invalid, and the verification is not passed.
5. The method for verifying the user invitation code according to claim 4, wherein the specific method for resolving the third invitation code id, performing the confusion inverse operation and the diffusion inverse operation on the third invitation code id according to a preset algorithm, and obtaining the fourth invitation code id comprises the following steps: performing exclusive or decryption calculation on the third invitation code id by using a key byte array generated when the user invitation code is generated to obtain a first integer invitation code id; and converting the first integer invitation code id into a two-dimensional matrix, performing column and row inverse displacement on the two-dimensional matrix according to a preset algorithm, and converting the two-dimensional matrix after the inverse displacement into a fourth invitation code id.
6. The method for verifying the user invitation code according to claim 4, wherein the specific method for disassembling and mapping the user invitation code to obtain the second array comprises the following steps: and disassembling the character string of the user invitation code into a plurality of characters, searching each character in the defined character space by using the character space defined when the user invitation code is generated, and combining indexes of the characters in the character space according to the character sequence in the character string to obtain a second group.
7. A user invitation code generating apparatus, comprising:
the user id acquisition module is used for requesting to acquire a user invitation code interface and acquiring the current user id;
the user invitation code id generation module is used for generating a user invitation code id;
the user invitation code record generation module is used for newly generating a user invitation code record in the database, wherein the record information comprises the user id, the user invitation code id and the validity period of the user invitation code;
the data storage module is used for storing the newly generated user invitation code record in the database;
a first invitation code id generation module, configured to combine the user id and the user invitation code id to generate a first invitation code id;
the second invitation code id generation module is used for diffusing and confusing the first invitation code id through a preset algorithm to obtain a second invitation code id;
the first array generation module is used for carrying out binary conversion and check bit calculation on the second invitation code id through a preset rule to obtain a first array;
and the invitation code generation module is used for carrying out position mapping on the first array and combining the first array to obtain a user invitation code.
8. A user invitation code verification apparatus, comprising:
the invitation code receiving module is used for receiving a user invitation code input by a user;
the disassembly and mapping module is used for disassembling and mapping the user invitation code to obtain a second array;
the check bit module is used for checking check bits of the second number group according to a preset rule; if the verification is not passed, the user invitation code is invalid;
the system conversion module is used for carrying out system conversion on the second number group after checking to obtain a third invitation code id;
the analysis module is used for carrying out confusion inverse operation and diffusion inverse operation on the third invitation code id according to a preset algorithm to obtain a fourth invitation code id;
the splitting module is used for splitting the fourth invitation code id into a first user id and a first user invitation code id;
the verification module is used for searching the user invitation code records corresponding to the first user id and the first user invitation code id from the user invitation code records pre-stored in the database; wherein the user invitation code record is generated by using the user invitation code generating means of claim 7; if the corresponding user invitation code record exists and is still in the validity period currently, the validity of the user invitation code is verified, otherwise, the user invitation code is invalid, and the verification is not passed.
9. A user invitation code generating device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the user invitation code generating method of any one of claims 1 to 3 when the computer program is executed.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the user invitation code generation method of any one of claims 1 to 3.
11. A user invitation verification device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the user invitation verification method of any one of claims 4 to 7.
12. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the user invitation code verification method of any one of claims 4 to 7.
CN202011209419.XA 2020-11-03 2020-11-03 User invitation code generation method, verification method, device, equipment and storage medium Active CN112487253B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011209419.XA CN112487253B (en) 2020-11-03 2020-11-03 User invitation code generation method, verification method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011209419.XA CN112487253B (en) 2020-11-03 2020-11-03 User invitation code generation method, verification method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112487253A CN112487253A (en) 2021-03-12
CN112487253B true CN112487253B (en) 2024-04-05

Family

ID=74927707

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011209419.XA Active CN112487253B (en) 2020-11-03 2020-11-03 User invitation code generation method, verification method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112487253B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113221009A (en) * 2021-05-26 2021-08-06 东莞市盟大塑化科技有限公司 Invitation code generation method, device, equipment and storage medium
CN113987434B (en) * 2021-12-30 2022-05-20 北京翼辉信息技术有限公司 User management method, system and medium of operating system based on cloud edge cooperation
CN115473717B (en) * 2022-09-05 2023-09-01 杭州思拓瑞吉科技有限公司 Energy storage system time sequence data verification method based on prime power remainder

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105046530A (en) * 2015-08-05 2015-11-11 北京铭嘉实咨询有限公司 Method and system for providing services to user from online to offline
CN106911645A (en) * 2015-12-23 2017-06-30 阿里巴巴集团控股有限公司 Server access method and relevant device
CN110135144A (en) * 2019-05-20 2019-08-16 北京金山安全软件有限公司 Invitation code generation method, verification method, device, electronic equipment and storage medium
CN110489466A (en) * 2019-07-03 2019-11-22 平安证券股份有限公司 Generation method, device, terminal device and the storage medium of invitation code
JP2019220885A (en) * 2018-06-21 2019-12-26 株式会社リコー Management device, transmission system, convention management method
CN110619204A (en) * 2019-08-28 2019-12-27 深圳市融壹买信息科技有限公司 Invitation code generation method and device, terminal equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11657136B2 (en) * 2017-12-21 2023-05-23 Bitstrata Systems Inc. Secure association of an installed application instance with a service

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105046530A (en) * 2015-08-05 2015-11-11 北京铭嘉实咨询有限公司 Method and system for providing services to user from online to offline
CN106911645A (en) * 2015-12-23 2017-06-30 阿里巴巴集团控股有限公司 Server access method and relevant device
JP2019220885A (en) * 2018-06-21 2019-12-26 株式会社リコー Management device, transmission system, convention management method
CN110135144A (en) * 2019-05-20 2019-08-16 北京金山安全软件有限公司 Invitation code generation method, verification method, device, electronic equipment and storage medium
CN110489466A (en) * 2019-07-03 2019-11-22 平安证券股份有限公司 Generation method, device, terminal device and the storage medium of invitation code
CN110619204A (en) * 2019-08-28 2019-12-27 深圳市融壹买信息科技有限公司 Invitation code generation method and device, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN112487253A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
CN112487253B (en) User invitation code generation method, verification method, device, equipment and storage medium
CN109040341B (en) Intelligent contract address generation method and device, computer equipment and readable storage medium
KR101572111B1 (en) Electronic device and method for generating random and unique code
CN110489466B (en) Method and device for generating invitation code, terminal equipment and storage medium
CN101036340A (en) Two-way error correction for physical tokens
CN112133396B (en) Medical data sharing method and device, electronic equipment and medium
CN109493054B (en) Multi-chain information management method, device, storage medium and block chain identity analyzer
CN110275695B (en) Non-repetitive random code generation method, equipment, storage medium and device
Idalino et al. Locating modifications in signed data for partial data integrity
CN112948895A (en) Data watermark embedding method, watermark tracing method and device
CN114365134A (en) Secure identity card using unclonable functions
CN111984989A (en) Method, device, system and medium for verifying, issuing and accessing URL (uniform resource locator)
US11917052B2 (en) Hash algorithm method, hash algorithm circuit, and electronic device
CN110020040B (en) Method, device and system for querying data
GB2551787A (en) Generating a plurality of one time tokens
CN110619204A (en) Invitation code generation method and device, terminal equipment and storage medium
EP3232319B1 (en) Random number generation apparatus, random number generation method and program
CN113032742B (en) Data desensitization method and device, storage medium and electronic device
CN113837765B (en) Payment verification method, device, equipment and storage medium
CN112073174B (en) Communication account decryption method, device, equipment, storage medium and information interaction system
CN115840953A (en) Identity authentication method, device, terminal and readable storage medium
CN113794716B (en) Network access authentication method, device and equipment for terminal equipment and readable storage medium
CN113312651B (en) Interactive authentication method, device, equipment and computer readable storage medium
CN116828404B (en) Industry short message accurate sending method and device, electronic equipment and medium
CN114710352B (en) Password calling method and device of PHP system, electronic equipment and storage medium

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
TA01 Transfer of patent application right

Effective date of registration: 20240311

Address after: 518000 8th floor, No. 1 plant, Daqian industrial plant, zone 67, Xingdong community, Xin'an street, Bao'an District, Shenzhen City, Guangdong Province

Applicant after: Guangrui Technology (Shenzhen) Co.,Ltd.

Country or region after: China

Address before: 510000 room 627, No.2 Huaxu street, Tianhe District, Guangzhou City, Guangdong Province (office only)

Applicant before: Care for the future (Guangdong) Information Technology Co.,Ltd.

Country or region before: China

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant