CN112487253A - 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
CN112487253A
CN112487253A CN202011209419.XA CN202011209419A CN112487253A CN 112487253 A CN112487253 A CN 112487253A CN 202011209419 A CN202011209419 A CN 202011209419A CN 112487253 A CN112487253 A CN 112487253A
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.)
Granted
Application number
CN202011209419.XA
Other languages
Chinese (zh)
Other versions
CN112487253B (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
Care For Future Guangdong Information Technology 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 Care For Future Guangdong Information Technology Co ltd filed Critical Care For Future Guangdong Information Technology 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

Images

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The present invention relates to the field of information technologies, and in particular, to a user invitation code generation method, a user invitation code verification device, a user invitation code device, and a storage medium. 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 application 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 codes are irregular and can not be cracked easily, and the safety is high; the user invitation code comprises the expiration information and can be applied to scenes with requirements on the 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 user invitation code generation method, a user invitation code verification device, a user invitation code device, and a storage medium.
Background
Currently, many mobile applications have a registration invitation mechanism to trace back to the inviter to assign the corresponding reward. The core of the invitation mechanism is an invitation code, and the characteristics of the invitation code comprise that different individuals can be distinguished by unique identification, the length is short, and the corresponding individuals can be traced. The current invitation code is generated by random generation, hash value based on MD5, binary conversion and the like.
The current common technical scheme includes a method for generating based on MD5 and generating by splicing check codes and identification codes. The idea of the technical scheme based on the MD5 is that a hash array is generated by using an MD5 algorithm to a reference identification code, then the hash array is converted into a verification character string, then position transformation is carried out on the hash array to generate a target character string, and finally the verification character string and the target character string are spliced to form the target character string. Due to the nature of MD5, MD5 has a possibility of generating collisions, and in addition, most MD5 information needs to be discarded in the process of generating the hash array to reduce the length of the generated invitation code, so the possibility of generating invitation code collisions increases a great probability. In addition, the technical scheme of splicing and generating the characteristic value and the identification code is used, first, a first redundancy check code and a second redundancy check code are obtained on the basis of the random character string, the database main key identification and the key generation conversion, and then the invitation code is generated by splicing the first redundancy check code, the database main key identification and the second redundancy check code. And finally, the invitation codes are generated by splicing the check codes and the primary key identifiers of the database, so that the generated invitation codes are relatively similar, hackers can easily attack and crack other invitation codes by using guessing and brute force methods, and the security is not high.
Disclosure of Invention
The object of the present application is to solve at least to some extent the above mentioned technical problems.
Therefore, the first aspect of the application provides a user invitation code generation method, which is based on cryptography and mathematical theory, and performs bit diffusion, confusion and encryption operations on a user unique identifier in the user invitation code generation process, so that the problems of invitation code conflict and easy cracking are solved.
A second aspect of the present application provides a user invitation code verification method.
A third aspect of the present application provides a user invitation code generating apparatus.
A fourth aspect of the present application provides a user invitation code verification apparatus.
A fifth aspect of the present application provides an apparatus.
A sixth aspect of the present application provides a computer-readable storage medium.
A seventh aspect of the present application sets forth 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 provides a method for generating a user invitation code, which includes the following specific contents:
a method of user invitation code generation, 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 system 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 the user invitation code.
Further, the specific process of performing position mapping on the first array and combining to obtain the user invitation code is as follows: defining a character space, wherein each bit of character is unique in the space and random in position, taking each bit of numerical value in the first array as an index to find out a corresponding character in the character string, and finally combining each obtained character to obtain the user invitation code.
Further, the first invitation code id is converted into a two-dimensional matrix, and column displacement and row displacement are carried out on the two-dimensional matrix according to a preset algorithm; and converting the shifted two-dimensional matrix into an integer invitation code id, and randomly generating a key byte array by the system for carrying out XOR calculation on the integer invitation code id to obtain a second invitation code id.
In a second aspect, the present application provides a method for verifying a user invitation code, which includes the following specific contents:
a method of user invitation code verification, the method comprising:
receiving a user invitation code input by a user;
disassembling the user invitation codes and mapping positions to obtain a second array;
checking a check digit of the second array according to a preset rule, and if the check is not passed, the user invitation code is invalid; if the check is passed, carrying out system conversion on the second array 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 the first user id and the first user invitation code id from a user invitation code record pre-stored in a 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 the current validity period still exists, the validity verification of the user invitation code is passed, otherwise, the user invitation code is invalid and the verification is not passed.
Further, the specific method for analyzing the third invitation code id, performing confusion inverse operation and diffusion inverse operation on the third invitation code id according to a preset algorithm, and obtaining the fourth invitation code id includes: using a key byte array generated when the user invitation code is generated in the first aspect, and carrying out XOR decryption calculation on the third invitation code id to obtain a first integer invitation code id; and converting the first integer invitation code id into a two-dimensional matrix, performing row-column inverse shift and row-column inverse shift on the two-dimensional matrix according to a preset algorithm, and converting the two-dimensional matrix after the inverse shift into a fourth invitation code id.
Further, the specific method for obtaining the second array by disassembling and mapping the user invitation code includes: and disassembling the user invitation code character string into a plurality of characters, generating a defined character space when the user invitation code is generated by using 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 provides a device for generating a user invitation code, which 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 generating module is used for newly generating 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;
the data storage module is used for storing a user invitation code record newly generated in the database;
the first invitation code id generating module is used for combining 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 system conversion on the second invitation code id through a preset rule and calculating a check bit to obtain a first array;
and the invitation code generating module is used for mapping the positions of the first arrays and combining the first arrays to obtain the user invitation codes.
In a fourth aspect, the present application provides a user invitation code verification apparatus, which 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 disassembling and mapping module is used for disassembling and mapping the user invitation codes to obtain a second array;
the check bit module is used for checking the check bits of the second array according to a preset rule; if the check is not passed, the user invitation code is invalid;
the system conversion module is used for carrying out system conversion on the second array after the check is passed to obtain a third invitation code id;
the analysis module is used for 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;
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 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 the third aspect; if the corresponding user invitation code record exists and the current validity period still exists, the validity verification of the user invitation code is passed, otherwise, the user invitation code is invalid and the verification is not passed.
In a fifth aspect, the present application provides an apparatus, which includes:
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 of the first aspect when executing the computer program.
In a sixth aspect, the present application provides a computer-readable storage medium, which 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 of the first aspects described above.
In a seventh aspect, the present application provides an apparatus, which includes:
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 of the second aspects above when executing the computer program.
In an eighth aspect, the present application provides a computer-readable storage medium, which includes:
a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the user invitation code authentication method according to any of the second aspects described above.
The beneficial effect of this application:
(1) the generated user invitation code is short and unique, and compared with a scheme based on MD5, the generated user invitation code is ensured not to be repeated.
(2) Based on the cryptography technology of diffusion and confusion, the key space is large, the generated user invitation codes are irregular and can not be cracked easily, and the safety is ensured.
(3) The generated user invitation code comprises the expiration information and can be suitable for scenes with requirements on the temporary invitation code.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flow chart of a user invitation code generation method according to an embodiment of the present application;
fig. 2 is a schematic 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 apparatus 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 structures, 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 will 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 and includes any and all possible combinations of one or more of the associated listed items.
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this 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 present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated 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 and a cloud server, and can be specifically realized by running an application program (APP or other systems) in the terminal equipment.
As shown in fig. 1, a flowchart of a user invitation code generation method provided for an embodiment of a first aspect of the present application is provided, by way of example and not limitation, the method including:
the client requests to acquire a user invitation code interface and acquires a current user initial identifier;
in the embodiment of the application, the User invitation codes correspond to the users one to one, so that 32-bit integer User ids, namely uid (User Identification) is directly used as the initial identifiers, and only the current 32-bit integer User ids need to be directly obtained, wherein the 32-bit integer User ids are generated by a system through a database id self-increment mode when the User registers an account, and the 32-bit integer User ids are unique for each User.
Particularly, when the client acquires the 32-bit integer user id, if the user does not exist, the client prompts the user to register an account, and the system generates the 32-bit integer user id in a database id self-increment mode.
After obtaining 32-bit integer user id, generating 32-bit integer user invitation code id according to the 32-bit integer user id, and newly generating and storing a user invitation code record in a database, wherein the record information comprises the 32-bit integer user id, the 32-bit integer user invitation code id 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 combined method in the embodiments of the present application may be: and combining the 32-bit integer user id as a high bit and the 32-bit integer user invitation code id as a low bit to form a 64-bit integer first invitation code id. The combination is not particularly limited.
Specifically, after obtaining the 64-bit integer first invite code id, the 64-bit integer first invite code id is diffused and obfuscated by a preset algorithm to obtain a 64-bit integer second invite code id, obfuscation is an encryption operation that makes a relationship between a key and a ciphertext as fuzzy as possible, and diffusion is an encryption operation that diffuses an influence of a plaintext symbol to a plurality of ciphertext symbols in order to hide statistical properties of the plaintext. In the embodiment of the present application, a 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 column shift and row shift according to the rule of matrix [ i ] [ j ] ═ matrix [ i × P1% 8] [ j × P2% 8], wherein parameters i and j represent row and column indexes respectively, and parameters P1 and P2 are two non-uniform positive integers and are coprime to integer 8; after the shifting is completed, the two-dimensional matrix is converted into the 64-bit integer invitation code id again, and accordingly, the 64-bit integer first invitation code id is diffused. Then, the system randomly generates a 64-bit key byte array, and performs exclusive-or calculation on the 64-bit integer invitation code id by using the key byte array to obtain the obfuscated second invitation code id (still 64 bits). By this, the diffusion and obfuscation of the 64-bit integer first invite code id is completed.
After the diffusion and confusion of the 64-bit integer first invitation code id are completed, carrying out the binary conversion and the check bit calculation on the 64-bit integer second invitation code id through a preset rule to obtain a first array.
Specifically, the specific method for performing binary conversion and calculating the check bit on the 64-bit integer second invite code id through the preset rule to obtain the first array may be: generating an integer array with the length of 6 bits (the length of the user invitation code in the embodiment of the application is set to be 6 bits), assigning a 64-bit integer second invitation code id to a first bit of the integer array, then performing 64-system conversion operation, wherein the conversion only operates the first 5 bits of the array, and the last bit is left as a check bit, specifically: the next digit value of the integer array is equal to the digit value of the current digit divided by the integer 64, the current digit of the integer array takes the remainder of the integer 64, the remainder is reassigned to the current digit of the integer array, and so on, the first 5 digits of the array are converted into the system. As for a specific method of calculating the check bits, it may be: accumulating the first 5 digit values of the integer array after the binary conversion is completed, multiplying the obtained sum by a prime number P3(P3 is relatively prime to an integer 64), taking the remainder of the integer 64 to obtain a check value, and storing the check value in the last digit of the integer array. Thus, after the binary conversion and the calculation of the check bit, the first array of the complete 6-bit number is obtained.
Specifically, after a first array is obtained, the first array is subjected to position mapping and combined to obtain a user invitation code. In an embodiment of the present application, a specific method may be that a character space with a length of 64 is defined, each bit of character is unique in the space, the position is random, each bit of numerical value in the first array is used as an index to find a corresponding character in a character string of the character space, and finally each obtained character is combined to obtain the user invitation code.
And finally, updating the user invitation code and returning the user invitation code 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 guaranteed not to be repeated compared with a scheme based on MD 5. Based on the cryptography technology of diffusion and confusion, the key space is large, the generated user invitation codes are irregular and can not be cracked easily, and the safety is ensured. In addition, the user invitation code generated by the application comprises the expiration information, and can be suitable for scenes with requirements on the temporary invitation code.
As shown in fig. 2, an embodiment of a 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 comprises:
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 the user invitation codes and mapping positions to obtain a second array;
specifically, the specific method for disassembling and mapping the position may be: the method comprises the steps of disassembling a user invitation code character string into 6 characters, generating a character space with a length of 64 defined when the user invitation code is generated by using the embodiment of the first aspect of the application, 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 a second number group is obtained, checking a check digit of the second number group according to a preset rule, and if the check is not passed, the user invitation code is invalid; if the check is passed, carrying out system conversion on the second array to obtain a third invitation code id; in the embodiment of the present application, a specific method for checking the parity may be: accumulating the first 5 digit values of the second array, multiplying the obtained sum by a prime number P3(P3 is relatively prime with an integer 64), then taking the remainder of the integer 64 to obtain a calculated check value, comparing the calculated check value with the last digit of the second array, and if the calculated check value and the last digit of the second array are not equal, the verification fails and the user invitation code is invalid; otherwise, the check is passed, and the next flow is entered. In the embodiment of the present application, a specific method of the binary conversion may be: and converting the integers of the first 5 bits of the second array, calculating from the 5 th bit to the front, adding the product of the numerical value of the previous bit and the integer 64 to the numerical value of each bit, and assigning the result to the previous bit until the calculation is finished when the previous bit is the first bit of the second array to obtain a 64-bit integer third invitation code id.
After the third invitation code id is obtained, 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 64-bit integer fourth invitation code id.
Specifically, the specific method for analyzing the third invitation code id, performing confusion inverse operation and diffusion inverse operation on the third invitation code id according to a preset algorithm, and obtaining the fourth invitation code id includes: using a 64-bit key byte array generated when the embodiment of the first aspect of the application generates the user invitation code, and 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-row inverse shift and row-row inverse shift according to the rule of matrix [ i ] [ j ] ═ matrix [ i × P1% ] [ j × P2% 8], wherein parameters i and j represent indexes of rows and columns respectively, and parameters P1 and P2 are relatively prime to integer 8; and finally, converting the two-dimensional matrix after the reverse shift is finished into a 64-bit integer fourth invitation code id.
Splitting the fourth invitation code id into a 32-bit integer first user id and a 32-bit integer first user invitation code id; the specific splitting method can be as follows: the 32-bit integer first user id is the upper bits of the 64-bit integer fourth invitation code id, and the 32-bit integer first user id is the lower bits of the 64-bit integer fourth invitation code id.
After splitting the 64-bit integer fourth invitation code id, searching user invitation code records corresponding to the 32-bit integer first user id and the 32-bit integer first user invitation code id from user invitation code records pre-stored in a 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 present application; and if the corresponding user invitation code record exists and the current user invitation code is still in the validity period, the validity verification of the user invitation code is passed, 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 in the above-mentioned embodiment of the first aspect of the present application by way of example and not limitation, and since the user invitation code generating device provided in the embodiment of the present application corresponds to the user invitation code generating method provided in the above-mentioned embodiment of the first aspect of the present application, the foregoing embodiment of the user invitation code generating method is also applicable to the user invitation code generating device provided in the present embodiment, and is not described in detail in the present 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. The method comprises 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 a 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 a user invitation code record newly generated 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 confuse 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 system conversion and check bit calculation on the second invite code id through a preset rule to obtain a first array;
and the invitation code generating module 108 is configured to perform position mapping on the first array and combine the first array 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, by way of example and not limitation, which corresponds to the user invitation code verification method provided in the above-mentioned embodiment of the second aspect of the present application, and since the user invitation code verification apparatus provided in the embodiment of the present application corresponds to the user invitation code verification method provided in the above-mentioned embodiment of the second aspect of the present application, the foregoing embodiment of the user invitation code verification method is also applicable to the user invitation code verification apparatus provided in the present 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 apparatus according to an embodiment of the fourth aspect of the present application. The method comprises 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;
a check digit module 203, configured to check a check digit of the second array according to a preset rule; if the check is not passed, the user invitation code is invalid;
the system conversion module 204 is configured to perform system conversion on the second array after the check is passed, so as to obtain a third invitation code id;
the parsing module 205 is configured to perform an obfuscating inverse operation and a diffusing inverse operation on the third invitation code id according to a preset algorithm 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;
the verification module 207 is configured to search a user invitation code record corresponding to the first user id and the first user invitation code id from a user invitation code record pre-stored in the database; wherein the user invitation code record is generated by using the user invitation code generating device of the embodiment of the third aspect; if the corresponding user invitation code record exists and the current validity period still exists, the validity verification of the user invitation code is passed, 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 executing the computer program.
An embodiment of a sixth aspect of the present application proposes a computer-readable storage medium, which stores a computer program, which when executed by a processor implements the steps of the user invitation code generation method according to any of the embodiments of the first aspect.
An embodiment of a seventh 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 authentication method according to any embodiment of the second aspect when executing the computer program.
An embodiment of the eighth aspect of the present application proposes a computer-readable storage medium, which stores a computer program, which when executed by a processor implements the steps of the user invitation code authentication method according to any of the embodiments of the second aspect.
The terminal equipment can be computing equipment such as a desktop computer, a notebook computer, a palm computer and a cloud server. The terminal device may also comprise more or fewer components or a combination of certain components or different components, e.g. the terminal device may also comprise input output devices, network access devices, buses etc.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. 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, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and so on, provided on the terminal device. 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-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an 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 apparatus/terminal apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), random-access Memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative 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 implementation. 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-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within 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 system 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 the user invitation code.
2. The method for generating a user invitation code according to claim 1, wherein the specific process of mapping the positions of the first arrays and combining the first arrays to obtain the user invitation code comprises: defining a character space, wherein each bit of character is unique in the space and random in position, taking each bit of numerical value in the first array as an index to find out a corresponding character in the character string, and finally combining each obtained character to obtain the user invitation code.
3. The method for generating a user invitation code according to claim 1, wherein the specific method for diffusion 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 shifted two-dimensional matrix into an integer invitation code id, and randomly generating a key byte array by the system for carrying out XOR calculation on the integer invitation code id to obtain a second invitation code id.
4. A method for user invitation code verification, the method comprising:
receiving a user invitation code input by a user;
disassembling the user invitation codes and mapping positions to obtain a second array;
checking a check digit of the second array according to a preset rule, and if the check is not passed, the user invitation code is invalid; if the check is passed, carrying out system conversion on the second array 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 the first user id and the first user invitation code id from a user invitation code record pre-stored in a 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 the current validity period still exists, the validity verification of the user invitation code is passed, 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 analyzing the third invitation code id, performing the confusion inverse operation and the diffusion inverse operation on the third invitation code id according to the preset algorithm to obtain the fourth invitation code id comprises the following steps: carrying out XOR 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 row-column inverse shift and row-column inverse shift on the two-dimensional matrix according to a preset algorithm, and converting the two-dimensional matrix after the inverse shift into a fourth invitation code id.
6. The method for verifying the user invitation code according to claim 4, wherein the specific method for obtaining the second array by disassembling and mapping the user invitation code comprises: and disassembling the user invitation code character string into a plurality of characters, using a defined character space when the user invitation code is generated, 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 number 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 generating module is used for newly generating 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;
the data storage module is used for storing a user invitation code record newly generated in the database;
the first invitation code id generating module is used for combining 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 system conversion on the second invitation code id through a preset rule and calculating a check bit to obtain a first array;
and the invitation code generating module is used for mapping the positions of the first arrays and combining the first arrays to obtain the user invitation codes.
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 disassembling and mapping module is used for disassembling and mapping the user invitation codes to obtain a second array;
the check bit module is used for checking the check bits of the second array according to a preset rule; if the check is not passed, the user invitation code is invalid;
the system conversion module is used for carrying out system conversion on the second array after the check is passed to obtain a third invitation code id;
the analysis module is used for 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;
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 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 the current validity period still exists, the validity verification of the user invitation code is passed, otherwise, the user invitation code is invalid and the verification is not passed.
9. An apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the user invitation code generation method according to any one of claims 1 to 3 when executing the computer program.
10. 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 generation method according to any one of claims 1 to 3.
11. An apparatus 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 code verification method according to any of claims 4 to 7.
12. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the steps of the user invitation code verification method according to 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 true CN112487253A (en) 2021-03-12
CN112487253B 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)

Cited By (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
CN113987434A (en) * 2021-12-30 2022-01-28 北京翼辉信息技术有限公司 User management method, system and medium of operating system based on cloud edge cooperation
CN115473717A (en) * 2022-09-05 2022-12-13 杭州思拓瑞吉科技有限公司 Energy storage system time sequence data verification method based on co-prime power remainder

Citations (7)

* 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
US20190197231A1 (en) * 2017-12-21 2019-06-27 Bitstrata Systems Inc. Secure association of an installed application instance with a service
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

Patent Citations (7)

* 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
US20190197231A1 (en) * 2017-12-21 2019-06-27 Bitstrata Systems Inc. Secure association of an installed application instance with a service
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

Cited By (4)

* 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
CN113987434A (en) * 2021-12-30 2022-01-28 北京翼辉信息技术有限公司 User management method, system and medium of operating system based on cloud edge cooperation
CN115473717A (en) * 2022-09-05 2022-12-13 杭州思拓瑞吉科技有限公司 Energy storage system time sequence data verification method based on co-prime power remainder
CN115473717B (en) * 2022-09-05 2023-09-01 杭州思拓瑞吉科技有限公司 Energy storage system time sequence data verification method based on prime power remainder

Also Published As

Publication number Publication date
CN112487253B (en) 2024-04-05

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
US8208627B2 (en) Format-preserving cryptographic systems
CN110489466B (en) Method and device for generating invitation code, terminal equipment and storage medium
CN106161006B (en) Digital encryption algorithm
US11488134B2 (en) Format-preserving cryptographic systems
US20140089203A1 (en) Format-preserving cryptographic systems
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
CN107241184B (en) Personal password generation and management method based on improved AES
CN105373986A (en) Realization method for hospital film-free cloud computing
CN110704875B (en) Method, device, system, medium and electronic equipment for processing client sensitive information
CN115333803A (en) User password encryption processing method, device, equipment and storage medium
Idalino et al. Locating modifications in signed data for partial data integrity
Jirjees et al. Passnumbers: An approach of graphical password authentication based on grid selection
CN112235104B (en) Data encryption transmission method, system, terminal and storage medium
CN117725062A (en) Database table processing method and device, storage medium and computer equipment
CN112463749A (en) File sharing method, device, medium and electronic equipment
Hanif et al. GAHBT: genetic-based hashing algorithm for managing and validating health data integrity in blockchain technology
US11917052B2 (en) Hash algorithm method, hash algorithm circuit, and electronic device
CN113378224B (en) Medical image storage method, device, equipment and storage medium
CN111756749B (en) Secure access method, device, equipment and storage medium
CN114595470A (en) Data processing method and device
Merdassi et al. Private security for the cloud mobile via a strong authentication method
CN113032742A (en) Data desensitization method and device, storage medium and electronic device

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