Number string code generation method and device

By performing multiple double-shooting algorithm operations on the initial digital code, a unique digital string code is solved, and the problems of low generation efficiency of digital string code and low utilization of natural number space in the prior art are achieved, and efficient and unique digital string code is achieved. generate.

CN119130462APending Publication Date: 2024-12-13SHANGHAI YIBAN ENTERPRISE DEVELOPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411268033.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-11
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

The existing digital string code generation method based on random algorithms has the possibility of repeated generation and the problem of low utilization of natural number space.

Method used

The initial digital code is mapped in an integral or segmented manner using multiple double-stroke algorithm to generate a unique digital string code to ensure that each initial digital code corresponds to a unique digital string code, and the utilization rate in the natural number space reaches 100%.

Benefits of technology

It improves the efficiency of numeric string code generation, avoids repeated generation and judgment links, and realizes efficient use of natural number space, ensuring that the numeric string code generated each time is unique.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119130462A_ABST
    Figure CN119130462A_ABST
Patent Text Reader

Abstract

The invention provides a numeric string code generation method and device. The method comprises the following steps: acquiring an initial digital code, wherein the initial digital code has W1 digits; sequentially dividing the initial digital code into W2 sections of digits, wherein W2 is greater than or equal to 1 and less than W1; for each section of number in the W2 sections of numbers, determining a first mapping value corresponding to a target section of number by adopting a first bijection algorithm, determining a second mapping value corresponding to the first mapping value by adopting a second bijection algorithm, and determining a third mapping value corresponding to the second mapping value by adopting a third bijection algorithm; and combining the third mapping values corresponding to each segment of number in the W2 segments of numbers into a numeric string code in sequence. The system comprises each function module for correspondingly realizing each step. According to the invention, the problems of low efficiency and low utilization rate of a natural number space of an existing numeric string code generation mode based on a random algorithm can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of digital string code generation, and more specifically, relates to a digital string code generation method and device. Background Art

[0002] A digital string code refers to a new digital code obtained by converting an initial digital code based on a specific algorithm or rule. This method of presenting the initial digital code in the form of a digital string code is mainly used to hide the relevant information carried by the initial digital code. The application scenarios of digital strings are very wide, such as order numbers. Specifically, in e-commerce transactions, each order will be assigned a unique digital string code as the order number. The digital string code is usually converted from a sequence of original order numbers. The use of digital strings as order numbers can effectively prevent merchants from stealing order numbers by inferring the encoding pattern of the original order numbers.

[0003] At present, existing digital codes are usually generated based on random generation algorithms. However, this digital code generation method based on random algorithms has the following two main problems:

[0004] 1. Randomly generated digital codes may be repeated, that is, the digital codes corresponding to two different initial digital codes are the same. Therefore, after the digital code is generated, it is necessary to query the previously generated digital code to determine whether the current digital code is a repeated and invalid generation, which leads to low efficiency in digital code generation;

[0005] 2. For randomly generated digital strings, the corresponding initial digital codes are randomly converted into other numbers as a whole or in pieces. These randomly converted numbers are hashed in a given natural number space, and the utilization rate of the natural number space is low. Summary of the invention

[0006] The purpose of the present invention is to solve the problems of low efficiency of the existing digital string code generation method based on random algorithm and low utilization of natural number space.

[0007] In order to achieve the above object, the present invention provides a method and device for generating a digital string code.

[0008] According to a first aspect of the present invention, a method for generating a digital string code is provided, the method comprising the following steps:

[0009] Obtaining an initial digital code, wherein the initial digital code has W1 digits;

[0010] Sequentially divide the initial digital code into W2 segments, 1≤W2<W1;

[0011] For each segment of the W2 segments, a first bijection algorithm is used to determine a first mapping value corresponding to the target segment, a second bijection algorithm is used to determine a second mapping value corresponding to the first mapping value, and a third bijection algorithm is used to determine a third mapping value corresponding to the second mapping value;

[0012] The third mapping values ​​corresponding to the respective segments of the W2 segments of numbers are sequentially combined into a digital string code.

[0013] Optionally, the first bijection algorithm is described as:

[0014] N={1,2,3...10 n};

[0015] a∈N;

[0016] mod(a)=(a×p)mod 10 n ;

[0017] p is a preset large prime number, so that mod(x) is a bijection on the set N;

[0018] mod(x) is the first mapping value corresponding to x.

[0019] Optionally, the second bijective algorithm is described as:

[0020] mod(a) is denoted as M(a,1);

[0021] mod(mod(a)) is denoted as M(a,2);

[0022] mod(mod(mod(a))) is denoted as M(a,3);

[0023] a,M(a,1),M(a,2),M(a,3)... constitute a sequence S;

[0024] len(S) is the length of sequence S, min(S) is the minimum value in sequence S;

[0025] offset(S)=min(S)mod len(S);

[0026] loop(a)=M(a,offset(S));

[0027] loop(x) is a bijection on the set N, and loop(x) is the second mapping value corresponding to mod(x).

[0028] Optionally, the third bijective algorithm is described as:

[0029] loop(a) is denoted as L(a,1);

[0030] loop(loop(a)) is denoted as L(a,2);

[0031] loop(loop(loop(a))) is denoted as L(a,3);

[0032] a,L(a,1),L(a,2),L(a,3)...constitute the sequence SS;

[0033] len(SS) is the length of sequence SS, min(SS) is the minimum value in sequence SS;

[0034] offset(SS)=min(SS)mod len(SS);

[0035] loop2(a)=L(a,offset(SS));

[0036] loop2(x) is a bijection on the set N, and loop2(x) is the third mapping value corresponding to loop(x).

[0037] According to a second aspect of the present invention, a digital string code generating device is provided, the digital string code generating device comprising the following functional modules:

[0038] An initial digital code acquisition module, used to acquire an initial digital code, wherein the initial digital code has W1 digits;

[0039] An initial digital code segmentation module, used to sequentially divide the initial digital code into W2 digital segments, 1≤W2<W1;

[0040] a mapping value acquisition module, configured to determine, for each segment of the W2 segments, a first mapping value corresponding to a target segment of the digits by using a first bijection algorithm, determine a second mapping value corresponding to the first mapping value by using a second bijection algorithm, and determine a third mapping value corresponding to the second mapping value by using a third bijection algorithm;

[0041] The digital string code acquisition module is used to sequentially combine the third mapping values ​​corresponding to each segment of the W2 segments of numbers into a digital string code.

[0042] Optionally, the first bijection algorithm is described as:

[0043] N={1,2,3...10 n};

[0044] a∈N;

[0045] mod(a)=(a×p)mod 10 n ;

[0046] p is a preset large prime number, so that mod(x) is a bijection on the set N;

[0047] mod(x) is the first mapping value corresponding to x.

[0048] Optionally, the second bijective algorithm is described as:

[0049] mod(a) is denoted as M(a,1);

[0050] mod(mod(a)) is denoted as M(a,2);

[0051] mod(mod(mod(a))) is denoted as M(a,3);

[0052] a,M(a,1),M(a,2),M(a,3)... constitute a sequence S;

[0053] len(S) is the length of sequence S, min(S) is the minimum value in sequence S;

[0054] offset(S)=min(S)mod len(S);

[0055] loop(a)=M(a,offset(S));

[0056] loop(x) is a bijection on the set N, and loop(x) is the second mapping value corresponding to mod(x).

[0057] Optionally, the third bijective algorithm is described as:

[0058] loop(a) is denoted as L(a,1);

[0059] loop(loop(a)) is denoted as L(a,2);

[0060] loop(loop(loop(a))) is denoted as L(a,3);

[0061] a,L(a,1),L(a,2),L(a,3)...constitute the sequence SS;

[0062] len(SS) is the length of sequence SS, min(SS) is the minimum value in sequence SS;

[0063] offset(SS)=min(SS)mod len(SS);

[0064] loop2(a)=L(a,offset(SS));

[0065] loop2(x) is a bijection on the set N, and loop2(x) is the third mapping value corresponding to loop(x).

[0066] The beneficial effects of the present invention are:

[0067] The digital string code generation method of the present invention first obtains an initial digital code, which has W1 digits; secondly, the initial digital code is divided into W2 segments of digits in turn, 1≤W2<W1; thirdly, for each segment of the W2 segments of digits, a first bijection algorithm is used to determine a first mapping value corresponding to a target segment of digits, a second bijection algorithm is used to determine a second mapping value corresponding to the first mapping value, and a third bijection algorithm is used to determine a third mapping value corresponding to the second mapping value; finally, the third mapping values ​​corresponding to each segment of the W2 segments of digits are sequentially combined into a digital string code.

[0068] The digital string code generation method of the present invention, on the one hand, adopts the overall or segmented multiple bijective algorithm operations on the initial digital code to obtain the corresponding digital string code. When the two initial digital codes are different, the digital string codes corresponding to the two are also different, and the digital string codes corresponding to the two initial digital codes will not be the same. Therefore, after each digital string code is generated, it is not necessary to perform the link of judging whether the current digital string code is a repeated invalid generation as in the existing digital string code generation method based on random algorithm, and has higher digital string code generation efficiency. On the other hand, because the initial digital code and the digital string code have a one-to-one correspondence relationship at the overall level or in the segmented situation, that is, they satisfy the bijective relationship, the digital string code generation method of the present invention has a higher utilization rate of a given natural number space than the existing digital string code generation method based on random algorithm, and can reach a utilization rate of 100%.

[0069] Based on the above, it can be seen that the digital string code generation method of the present invention can effectively solve the problems of low efficiency and low utilization of natural number space in the existing digital string code generation method based on random algorithm.

[0070] The digital string code generating device of the present invention and the digital string code generating method described above belong to a general inventive concept, and have at least the same beneficial effects as the digital string code generating method described above, and the beneficial effects are not repeated here.

[0071] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] The present invention may be better understood by referring to the following description taken in conjunction with the accompanying drawings, in which the same or similar reference numerals are used throughout the drawings to represent the same or similar components.

[0073] Figure 1 A flowchart of a method for generating a digital string code according to an embodiment of the present invention is shown;

[0074] Figure 2 A structural block diagram of a digital string code generating device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0075] In order to enable those skilled in the art to more fully understand the technical solution of the present invention, the exemplary embodiments of the present invention will be described in more comprehensive and detailed in conjunction with the accompanying drawings below. Obviously, the one or more embodiments of the present invention described below are only one or more of the specific ways in which the technical solution of the present invention can be implemented, and are not exhaustive. It should be understood that other ways belonging to a general inventive concept can be used to implement the technical solution of the present invention, and should not be limited by the exemplary embodiments described. Based on one or more embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.

[0076] Example: Figure 1 The figure shows a flow chart of the implementation of the digital string code generation method according to the embodiment of the present invention.

[0077] Reference Figure 1 The digital string generation method of the embodiment of the present invention comprises the following steps:

[0078] Step S100, obtaining an initial digital code, the initial digital code having W1 digits;

[0079] Step S200, divide the initial digital code into W2 segments of digital code, 1≤W2<W1;

[0080] Step S300: for each segment of the W2 segments, a first bijection algorithm is used to determine a first mapping value corresponding to the target segment, a second bijection algorithm is used to determine a second mapping value corresponding to the first mapping value, and a third bijection algorithm is used to determine a third mapping value corresponding to the second mapping value;

[0081] Step S400: Combine the third mapping values ​​corresponding to the respective segments of the W2 segments of numbers into a digital string code in sequence.

[0082] Furthermore, in step S200 of the embodiment of the present invention, the first bijection algorithm is described as follows:

[0083] N={1,2,3...10 n};

[0084] a∈N;

[0085] mod(a)=(a×p)mod10 n ;

[0086] p is a preset large prime number, so that mod(x) is a bijection on the set N;

[0087] mod(x) is the first mapping value corresponding to x.

[0088] Specifically, in the embodiment of the present invention, the bijection is defined as:

[0089] Suppose there is a set A,

[0090] 1. For any a∈A, there exists b∈A such that f(a)=b;

[0091] 2.a1,a2∈A,a1≠a2, then f(a1)≠f(a2);

[0092] f(x) is a bijection on the set A.

[0093] Specifically, in the embodiment of the present invention, for 1-10 n For any natural number in the natural number set, a corresponding natural number can be calculated through the first bijection algorithm. All natural numbers in the natural number set have a one-to-one correspondence with all natural numbers in the natural number set, which is a bijection.

[0094] Furthermore, in step S200 of the embodiment of the present invention, the second bijective algorithm is described as follows:

[0095] mod(a) is denoted as M(a,1);

[0096] mod(mod(a)) is denoted as M(a,2);

[0097] mod(mod(mod(a))) is denoted as M(a,3);

[0098] a,M(a,1),M(a,2),M(a,3)... constitute a sequence S;

[0099] len(S) is the length of sequence S, min(S) is the minimum value in sequence S;

[0100] offset(S)=min(S)mod len(S);

[0101] loop(a)=M(a,offset(S));

[0102] loop(x) is a bijection on the set N, and loop(x) is the second mapping value corresponding to mod(x).

[0103] Specifically, in the embodiment of the present invention, for 1-10n Any natural number in the natural number set can be calculated by the first bijection algorithm to obtain a natural number; for the newly obtained natural number, the first bijection algorithm is used again to calculate a new natural number; by repeating this process countless times, a natural number sequence S can be obtained. n The set of natural numbers is a finite set. The natural number sequence S will not be infinitely long, but will be connected end to end to form a ring (natural number ring).

[0104] After obtaining the natural number sequence S, a compound operation is performed on the smallest natural number on the natural number sequence S, the total number of natural numbers on the natural number sequence S, and the preset large prime number P, and the operation result is used as the offset value corresponding to the natural number sequence S, and the offset value is Q; any natural number on the natural number sequence S is offset by Q natural digits in one direction to obtain a new natural number. All natural numbers on the natural number sequence S have a one-to-one correspondence with all natural numbers on the natural number sequence S.

[0105] And 1-10 n Any natural number in the set of natural numbers must exist on a similar natural number ring, 1-10 n There are also many similar natural number rings in the natural number set, 1-10 n All natural numbers in the natural number set are related to 1-10 n All natural numbers in the natural number set have a one-to-one correspondence, which is a bijection.

[0106] Furthermore, in step S200 of the embodiment of the present invention, the third bijective algorithm is described as follows:

[0107] loop(a) is denoted as L(a,1);

[0108] loop(loop(a)) is denoted as L(a,2);

[0109] loop(loop(loop(a))) is denoted as L(a,3);

[0110] a,L(a,1),L(a,2),L(a,3)...constitute the sequence SS;

[0111] len(SS) is the length of sequence SS, min(SS) is the minimum value in sequence SS;

[0112] offset(SS)=min(SS)mod len(SS);

[0113] loop2(a)=L(a,offset(SS));

[0114] loop2(x) is a bijection on the set N, and loop2(x) is the third mapping value corresponding to loop(x).

[0115] Specifically, in the embodiment of the present invention, for 1-10 n Any natural number in the natural number set can be calculated by the second bijection algorithm to obtain a natural number; for the newly obtained natural number, the second bijection algorithm can be used again to calculate a new natural number; by repeating this process countless times, a natural number sequence SS can be obtained. n The set of natural numbers is a finite set. The natural number sequence SS will not be infinitely long, but will be connected end to end to form a ring (natural number ring).

[0116] After obtaining the natural number sequence SS, a compound operation is performed on the smallest natural number on the natural number sequence SS, the total number of natural numbers on the natural number sequence SS, and the preset large prime number P, and the operation result is used as the offset value corresponding to the natural number sequence SS, and the offset value is Q; any natural number on the natural number sequence SS is offset by Q natural digits in one direction to obtain a new natural number. All natural numbers on the natural number sequence SS have a one-to-one correspondence with all natural numbers on the natural number sequence SS.

[0117] And 1-10 n Any natural number in the set of natural numbers must exist on a similar natural number ring, 1-10 n There are also many similar natural number rings in the natural number set, 1-10 n All natural numbers in the natural number set are related to 1-10 n All natural numbers in the natural number set have a one-to-one correspondence, which is a bijection.

[0118] The digital string code obtained by the digital string code generation method according to the embodiment of the present invention is applicable to the following scenarios:

[0119] To prevent brute force crawling of user details pages or digital pet details pages, the user ID or pet ID in the page link address can be replaced with the corresponding digital string;

[0120] Lottery gift redemption coupons or various types of coupon codes also often use digital strings;

[0121] The order number and logistics tracking number use digital strings. Since they are not sequential numbers, they can prevent fraudulent merchants from guessing and stealing the order number and logistics tracking number.

[0122] Membership cards and recharge cards also use digital codes, which do not contain characters and are easy to input into mobile phones and computers.

[0123] Correspondingly, based on the digital string code generation method of the embodiment of the present invention, the embodiment of the present invention further proposes a digital string code generation device.

[0124] Figure 2 FIG. 1 shows a structural block diagram of a digital string code generating device according to an embodiment of the present invention. Figure 2 The digital string generation device of the embodiment of the present invention includes the following functional modules:

[0125] An initial digital code acquisition module, used to acquire an initial digital code, wherein the initial digital code has W1 digits;

[0126] An initial digital code segmentation module, used to sequentially divide the initial digital code into W2 digital segments, 1≤W2<W1;

[0127] a mapping value acquisition module, configured to determine, for each segment of the W2 segments, a first mapping value corresponding to a target segment of the digits by using a first bijection algorithm, determine a second mapping value corresponding to the first mapping value by using a second bijection algorithm, and determine a third mapping value corresponding to the second mapping value by using a third bijection algorithm;

[0128] The digital string code acquisition module is used to sequentially combine the third mapping values ​​corresponding to each segment of the W2 segments of numbers into a digital string code.

[0129] Accordingly, based on the digital string generation method of the embodiment of the present invention, the embodiment of the present invention also proposes a label printing device, which includes a processor, a memory and a printing module;

[0130] The processor implements the above digital string code generation method when executing the computer program stored in the memory to obtain the corresponding digital string code, and converts the digital string code information into a printing instruction and sends it to the printing module;

[0131] The printing module prints the corresponding digital string code information at the corresponding position of the label paper according to the received printing instruction.

[0132] Although one or more embodiments of the present invention are described above, it should be known to those skilled in the art that the present invention can be implemented in any other form without departing from its subject matter and scope. Therefore, the embodiments described above are illustrative rather than restrictive, and many modifications and substitutions are obvious to those skilled in the art without departing from the spirit and scope of the present invention as defined in the appended claims.

Claims

1. A method for generating a digital string, characterized in that: include: Obtaining an initial digital code, wherein the initial digital code has W1 digits; Sequentially divide the initial digital code into W2 segments, 1≤W2<W1; For each segment of the W2 segments, a first bijection algorithm is used to determine a first mapping value corresponding to the target segment, a second bijection algorithm is used to determine a second mapping value corresponding to the first mapping value, and a third bijection algorithm is used to determine a third mapping value corresponding to the second mapping value; The third mapping values ​​corresponding to the respective segments of the W2 segments of numbers are sequentially combined into a digital string code.

2. The method for generating a digital string according to claim 1, characterized in that: The first bijective algorithm is described as: N={1,2,3...10 n}; a∈N; mod(a)=(a×p)mod 10 n ; p is a preset large prime number, so that mod(x) is a bijection on the set N; mod(x) is the first mapping value corresponding to x.

3. The method for generating a digital string according to claim 2, characterized in that: The second bijective algorithm is described as: mod(a) is denoted as M(a,1); mod(mod(a)) is denoted as M(a,2); mod(mod(mod(a))) is denoted as M(a,3); a,M(a,1),M(a,2),M(a,3)... constitute a sequence S; len(S) is the length of sequence S, min(S) is the minimum value in sequence S; offset(S)=min(S)mod len(S); loop(a)=M(a,offset(S)); loop(x) is a bijection on the set N, and loop(x) is the second mapping value corresponding to mod(x).

4. The method for generating a digital string according to claim 3, characterized in that: The third bijective algorithm is described as: loop(a) is denoted as L(a,1); loop(loop(a)) is denoted as L(a,2); loop(loop(loop(a))) is denoted as L(a,3); a,L(a,1),L(a,2),L(a,3)...constitute the sequence SS; len(SS) is the length of sequence SS, min(SS) is the minimum value in sequence SS; offset(SS)=min(SS)mod len(SS); loop2(a)=L(a,offset(SS)); loop2(x) is a bijection on the set N, and loop2(x) is the third mapping value corresponding to loop(x).

5. A digital string generation device, characterized in that: include: An initial digital code acquisition module, used to acquire an initial digital code, wherein the initial digital code has W1 digits; An initial digital code segmentation module, used to sequentially divide the initial digital code into W2 segments, 1≤W2<W1; a mapping value acquisition module, configured to determine, for each segment of the W2 segments, a first mapping value corresponding to a target segment of the digits by using a first bijection algorithm, determine a second mapping value corresponding to the first mapping value by using a second bijection algorithm, and determine a third mapping value corresponding to the second mapping value by using a third bijection algorithm; The digital string code acquisition module is used to sequentially combine the third mapping values ​​corresponding to each segment of the W2 segments of numbers into a digital string code.

6. The digital string generation device according to claim 5, characterized in that: The first bijective algorithm is described as: N={1,2,3...10 n}; a∈N; mod(a)=(a×p)mod 10 n ; p is a preset large prime number, so that mod(x) is a bijection on the set N; mod(x) is the first mapping value corresponding to x.

7. The digital string generation device according to claim 6, characterized in that: The second bijective algorithm is described as: mod(a) is denoted as M(a,1); mod(mod(a)) is denoted as M(a,2); mod(mod(mod(a))) is denoted as M(a,3); a,M(a,1),M(a,2),M(a,3)... constitute a sequence S; len(S) is the length of sequence S, min(S) is the minimum value in sequence S; offset(S)=min(S)mod len(S); loop(a)=M(a,offset(S)); loop(x) is a bijection on the set N, and loop(x) is the second mapping value corresponding to mod(x).

8. The digital string generation device according to claim 7, characterized in that: The third bijective algorithm is described as: loop(a) is denoted as L(a,1); loop(loop(a)) is denoted as L(a,2); loop(loop(loop(a))) is denoted as L(a,3); a,L(a,1),L(a,2),L(a,3)...constitute the sequence SS; len(SS) is the length of sequence SS, min(SS) is the minimum value in sequence SS; offset(SS)=min(SS)mod len(SS); loop2(a)=L(a,offset(SS)); loop2(x) is a bijection on the set N, and loop2(x) is the third mapping value corresponding to loop(x).