Specific embodiment
Fig. 1 is the schematic diagram of a scenario in business realizing.The embodiment of the present application technical solution can be real among different users
Existing related service, such as with realization " red packet " distributing service, " discount coupon " distributing service etc., wherein red packet hair transmission business is specific
It can refer to, a user by way of providing red packet by giving other use for the fund of oneself or other virtual objects etc.
Family.The prior art is when realizing related service, it usually needs knows that Business Initiator user knows that accurate business recipient uses
Family could initiate business, also, often need to generate the address URL, or the mode of two dimensional code of the generation including URL is come
Notice business recipient user, it is extremely complex to be achieved process.For example, scene shown in Fig. 1, if if user A wishes and user
B, when user C etc. realizes data interaction, such as by taking the distributing service of realization " red packet " as an example, user A must designated user one by one
B, user C etc. is target object, then the plenty of time resource of user A can be expended when number of users is more.Meanwhile user A for
User B, user C's etc. is specified, needs premised on user B, user C etc. are the association user of user A, such as user B, user
C etc. needs in the form of " good friend " etc., is recorded in the address list of user A in advance;Meanwhile in the process, business recipient
User, if user B, user C also need the service chaining according to the user A business initiated, such as URL or two dimensional code, to access
And corresponding business is completed, business realizing process is complex.
In the embodiment of the present application, related service can be realized based on password, specifically, as shown in Fig. 2, the business realizing
In the process, can be using pass word as intermediary, or it is referred to as business interface, realize the interaction between user A and user B.Tool
Body, from user A to server-side request after, server-side be the associated password of object generation for needing interaction, and by the password
It is issued to user A;User A can be by directly transmitting, sharing to any ways such as social network-i i-platform or oral account, by password exhibition
Show and gives user B;So, when user B initiates to include the request of the password to server-side, it can be obtained associated interaction pair
As.
As it can be seen that interactive process is more simple, flexible during the business realizing based on password form, still, it is based on password
Incidence relation between interaction data, therefore, to assure that formation efficiency and uniqueness during password generated, efficient with guarantee,
The business realizing of safety.Therefore, the embodiment of the present application is just to provide a kind of password generated method, can be applied to above-mentioned business
In, as the interface of business access, to meet business realizing demand efficiently, safe.It is understood that the embodiment of the present application
The password generated method of offer also can be applied to other and need password other than it can be applied in above-mentioned business access
Occasion, such as the occasion as random cipher etc., herein with no restrictions.
Fig. 3 shows a kind of flow chart of password generated method according to one exemplary embodiment of the application, such as Fig. 3 institute
To show, this method is applied to server-side, it may comprise steps of:
Step 302, when detecting password generated instruction, the password generated sequence for corresponding to password generated instruction is generated
Number.
It in the present embodiment, can be by raw from increasing column-generation password for the server of non-distributed systems structure
At serial number, such as when being classified as section [1,99] from increasing (section setting can be carried out previously according to demand, or uses all number
Section) when, then the first password generated received instructs corresponding password generated serial number to increase ID=1, second mouth received certainly
Enabling generating instructs corresponding password generated serial number to increase ID=2 certainly, and so on.
In the present embodiment, it for the server of distributed system architecture, can determine for handling the password generated
The distributed server node of instruction, and in the corresponding number section of the distributed server node, according to detecting the mouth
The sequence for generating instruction is enabled, by from password generated sequence described in increasing column-generation;Wherein, different distributions formula server node pair
It should be in different number sections.By application distribution system structure, so that all distributed server nodes can be with concurrent processing password
Instruction is generated, to promote password generated efficiency;Meanwhile by distributing different number sections for different distributed server nodes,
It not being overlapped from the corresponding section of increasing sequence, it is ensured that each password generated serial number has global uniqueness, thus generate
Password also has global uniqueness.
Step 304, the password generated serial number is converted into pseudo random number.
In the present embodiment, the mapping relations between available predefined number section and processing function, selection are applied to
The processing function of the password generated serial number;Then, the password generated serial number is handled according to the processing function, is obtained
To the pseudo random number.
Wherein, different number sections can use identical processing function, different processing functions can also be used, to ensure puppet
The high randomness of random number.It should be noted that can be applied for generating the processing function of pseudo random number in the related technology
In the technical solution of the application, the application limits not to this.
Step 306, according to the password-type being pre-configured for the password generated serial number, corresponding code book is chosen.
In the present embodiment, password-type may include: character quantity and character combination mode.Wherein, password is character
String form, character quantity are the character number for constituting the character string, for example the character quantity of " 0000 " is 4, the word of " adf94d "
According with quantity is 6;Character combination mode, the i.e. type of every character of character string, such as " all characters are number ", " ending
Character is number and remaining character is letter " etc., wherein each character can be any for number, letter, Chinese character, additional character etc.
Type, the application limit not to this.
In the present embodiment, when the digit of the pseudo random number be less than the character quantity when, to the pseudo random number into
Row cover, and the pseudo random number after cover is generated as by the password according to the code book.For example the pseudo random number generated is
" 101 ", and the character quantity in password-type is 4, then can be handled by cover, pseudo random number is updated to " 0101 ", i.e.,
0 is added in forefront;It is of course apparent that other cover processing modes can also be used, such as in rearmost addition 0 or other words
Symbol, the cover processing mode actually used can be pre-configured with according to demand or be arranged in real time.
In this embodiment, it according to the character quantity and the character combination mode, chooses and corresponds to the pseudo random number
In each character code book, wherein in each code book comprising corresponding plaintext character in the pseudo random number with it is described
Mapping relations in character combination mode between corresponding ciphertext character;And it is described according to the code book to it is described it is pseudo- with
Machine number is converted, comprising: the corresponding code book of each character in the pseudo random number is successively determined, according to the password
The mapping relations for including in this, replace with corresponding ciphertext character for the plaintext character in the pseudo random number.
Step 308, the pseudo random number is converted according to the code book, obtains referring to corresponding to the password generated
The password of order.
In the present embodiment, when meeting default recycling condition, the password can also be recycled;For example work as password
Corresponding business has been completed or the life cycle of password has terminated, i.e., executable password recycling.Wherein, in recycling password
When, the occupancy resource of the password can be discharged;Alternatively, recording the password to data collection library.
In the present embodiment, when detecting password generated instruction, if it is determined that there are remainders in the data collection library
According to then selection corresponds to the password that the password generated instructs from the data collection library.
As can be seen from the above embodiments, the application is by generating password generated serial number, so that password generated instruction numeralization, with
Convenient for password generated;Meanwhile passing through the application to pseudo random number and code book, it is ensured that the password of generation has global uniqueness,
It ensure that the one-to-one correspondence between password and business.
Fig. 4 shows the flow chart of another password generated method according to one exemplary embodiment of the application, such as Fig. 4 institute
To show, this method is applied to each server node in distributed system, it may comprise steps of:
Step 402, detect that password generated instructs.
In the present embodiment, in conjunction with the application scenarios of " red packet granting ", password generating process is illustrated;Certainly, originally
Application obviously can also be applied in other business processions based on pass word, and the application limits not to this.
It is assumed that user A wishes to provide " red packet ", then user A needs to initiate interaction request to server-side, to determine granting
The information such as the amount of money, granting form in " red packet " quantity, each " red packet ".Based on the interaction request received, server-side is determined
It needs to provide for this " red packet " and generates corresponding password, then provide password generated instruction to certain server node, thus will
Password generated task is distributed to the server node.
Step 404, judge then to be transferred to step 406 if it exists with the presence or absence of remaining data in data collection library, be otherwise transferred to
Step 408A and step 408B.
Step 406, password is chosen from data collection library.
In the present embodiment, data collection library is used for the password for saving generation, being delivered to user and recycling, by recycling
Password is chosen in database, directly as final password and can be issued to user, without regenerating, be facilitated
It promotes response efficiency, save calculation resources.
Step 408A determines the corresponding number section of current server node for handling password generated instruction.
In the present embodiment, each server node is respectively present corresponding one or more number sections, these number sections are pre-
It first distributes to each server node, or is got when needed from management server by server node.Due to every
A number section simultaneously can only be by a server node use, and overlapping is not present between different number sections, therefore what is generated increases ID certainly
Identical situation will not occur, so that the high treatment capacity of distributed system can either be utilized, and can ensure from increasing ID
And the global uniqueness of corresponding final password.
Step 410A is generated in number section from ID is increased, as the password generated serial number for corresponding to password generated instruction.
In the present embodiment, for number section [1,99], then first during current server node corresponds to the number section
The password generated instruction received corresponds to increasing ID=1, second password generated instruction received certainly and corresponds to from increasing ID=
2 ... the last one password generated instruction received correspond to from increasing ID=99;After a number section use, server
Node can be used other configured number sections, or to other not used number sections of management server application.
Step 408B determines the corresponding password-type of current server node.
In the present embodiment, the password-type that each server node uses can also be pre-configured with, or with number section one
Management server in the same direction is applied and is obtained.Wherein, password-type may include: character quantity and character combination mode.Its
In, password is character string forms, and character quantity is the character number for constituting the character string, such as the character quantity of " 0000 " be 4,
The character quantity of " adf94d " is 6;Character combination mode, the i.e. type of every character of character string, for example " all characters are
Number ", " ending character is number and remaining character is letter " etc., wherein each character can be number, letter, Chinese character, spy
Any types, the application such as different symbol limit not to this.
Step 410B determines corresponding code book according to password-type.
Step 412, pseudo random number will be converted to from ID is increased.
In the present embodiment, the mapping relations between available predefined number section and processing function, selection are applied to
The processing function of the password generated serial number;Then, according to the processing function to the password generated serial number (increasing ID certainly)
It is handled, obtains the pseudo random number.
Wherein, different number sections can use identical processing function, different processing functions can also be used, to ensure puppet
The high randomness of random number.It should be noted that can be applied for generating the processing function of pseudo random number in the related technology
In the technical solution of the application, the application limits not to this.
As an exemplary embodiment, such as processing function are as follows: for any from ID is increased, be all incremented by 100;So, with
From for increasing ID=1, it is 101 that corresponding pseudo random number, which can be obtained,.
Step 414, judge character digit needed for whether the digit of pseudo random number meets password-type, be transferred to if meeting
Step 418, otherwise it is transferred to step 416.
Step 416, cover processing is carried out to pseudo random number.
In the present embodiment, by taking above-mentioned pseudo random number 101 as an example, it is assumed that character digit needed for password-type is 4, then exists
One 0 is supplemented before pseudo random number 101, obtaining final pseudo random number is 0101.
Step 418, pseudo random number is converted according to code book, obtains password.
In the present embodiment, corresponding plaintext character in pseudo random number and the character combination side are included in each code book
Mapping relations in formula between corresponding ciphertext character.Such as when pseudo random number is 0101, it is assumed that character combination mode is " to receive
Tail be number, remaining be letter ", then the pseudo random number 0101 at least corresponds to two code books, and " number is included in a code book
The mapping relations of word (plaintext) → number (ciphertext) " include " digital (plaintext) → letter (ciphertext) " in another code book
Mapping relations;As an exemplary embodiment, table 1 shows " digital (plaintext) → digital (ciphertext) " of an exemplary embodiment
Code book, table 2 show " digital (plaintext) → alphabetical (ciphertext) " code book of an exemplary embodiment, then pseudo random number 0101
9y9y can be correspondingly converted to.
In plain text |
Ciphertext |
0 |
9 |
1 |
8 |
… |
… |
Table 1
In plain text |
Ciphertext |
0 |
z |
1 |
y |
… |
… |
Table 2
In plain text |
Ciphertext |
0 |
1 |
1 |
2 |
… |
… |
Table 3
Even if different code books can also be used alternatively, the type of ciphertext character is identical.For example as an exemplary reality
Apply example, if the first number of regulation using code book shown in table 1, last figure using code book shown in table 3, remaining use table
Code book shown in 2, then pseudo random number 0101 can correspondingly be converted to 9y92.
Step 420, judge whether to reach the recycling condition to password, step 422 is transferred to if reaching, is otherwise returned.
In the present embodiment, recycling condition may include: that (for example red packet has provided completion), mouth is completed in corresponding business
The life cycle (such as 5 minutes) of order has terminated, and can be configured according to actual needs.
Step 422, password is recycled in data collection library.
In the present embodiment, in addition to password to be recycled in database, can also to the occupied number section resource of password into
Row release, so as to the recycling to number section.
Fig. 5 shows the schematic configuration diagram of the electronic equipment of the exemplary embodiment according to the application.Referring to FIG. 5,
In hardware view, which includes processor, internal bus, network interface, memory and nonvolatile memory, certainly
It is also possible that hardware required for other business.Processor read from nonvolatile memory corresponding computer program to
It is then run in memory, forms password generated device on logic level.Certainly, other than software realization mode, the application
Other implementations, such as logical device or the mode of software and hardware combining etc. is not precluded, that is to say, that following processing stream
The executing subject of journey is not limited to each logic unit, is also possible to hardware or logical device.
Referring to FIG. 6, the password generated device may include serial number gencration unit, serial number turn in Software Implementation
Change unit, code book selection unit and password generated unit.Wherein:
Serial number gencration unit generates the password for corresponding to password generated instruction when detecting password generated instruction
Generate serial number;
The password generated serial number is converted to pseudo random number by serial number converting unit;
Code book selection unit chooses corresponding password according to the password-type being pre-configured for the password generated serial number
This;
Password generated unit converts the pseudo random number according to the code book, obtains corresponding to the password
Generate the password of instruction.
Optionally, the password generated unit is specifically used for:
Determine the distributed server node for handling the password generated instruction;
In the corresponding number section of the distributed server node, according to the sequence for detecting password generated instruction,
By from password generated sequence described in increasing column-generation;Wherein, different distributions formula server node corresponds to different number sections.
Optionally, the serial number converting unit is specifically used for:
It obtains predefined number section and handles the mapping relations between function, choose and be applied to the password generated serial number
Handle function;
The password generated serial number is handled according to the processing function, obtains the pseudo random number.
Optionally, the password-type includes: character quantity and character combination mode.
Optionally, further includes:
Cover processing unit, when the digit of the pseudo random number be less than the character quantity when, to the pseudo random number into
Row cover, and the pseudo random number after cover is generated as by the password according to the code book.
Optionally, the code book selection unit is specifically used for:
According to the character quantity and the character combination mode, each word corresponded in the pseudo random number is chosen
The code book of symbol, wherein including corresponding plaintext character in the pseudo random number and the character combination mode in each code book
In mapping relations between corresponding ciphertext character;And
It is described that the pseudo random number is converted according to the code book, comprising:
The corresponding code book of each character in the pseudo random number is successively determined, according to including in the code book
Plaintext character in the pseudo random number is replaced with corresponding ciphertext character by the mapping relations.
Optionally, further includes:
Password recovery unit recycles the password when meeting default recycling condition.
Optionally, the password recovery unit is specifically used for:
Discharge the occupancy resource of the password;
Alternatively, recording the password to data collection library.
Optionally, further includes:
Password selection unit, when detecting password generated instruction, if it is determined that there are remainders in the data collection library
According to then selection corresponds to the password that the password generated instructs from the data collection library.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including described want
There is also other identical elements in the process, method of element, commodity or equipment.
The foregoing is merely the preferred embodiments of the application, not to limit the application, all essences in the application
Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the application protection.