CN114494474B - Generation method, verification method and device of universal verification code of human and legal equipment - Google Patents

Generation method, verification method and device of universal verification code of human and legal equipment Download PDF

Info

Publication number
CN114494474B
CN114494474B CN202210051928.7A CN202210051928A CN114494474B CN 114494474 B CN114494474 B CN 114494474B CN 202210051928 A CN202210051928 A CN 202210051928A CN 114494474 B CN114494474 B CN 114494474B
Authority
CN
China
Prior art keywords
verification code
picture
time
region
verification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210051928.7A
Other languages
Chinese (zh)
Other versions
CN114494474A (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.)
Guangdong University of Petrochemical Technology
Original Assignee
Guangdong University of Petrochemical Technology
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 Guangdong University of Petrochemical Technology filed Critical Guangdong University of Petrochemical Technology
Priority to CN202210051928.7A priority Critical patent/CN114494474B/en
Publication of CN114494474A publication Critical patent/CN114494474A/en
Application granted granted Critical
Publication of CN114494474B publication Critical patent/CN114494474B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/36User authentication by graphic or iconic representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics

Abstract

The invention discloses a generation method, a verification method and a device of a universal verification code for people and legal equipment, wherein the generation method, the verification method and the device comprise the following steps: generating a first background picture of the verification code, and storing corresponding generation time; coding the generation time by adopting a coding rule to obtain coded data corresponding to the generation time; dividing a plurality of time region pictures from the first background picture, and preprocessing the time region pictures to obtain a second background picture; and carrying out region division on the second background picture to obtain a verification code character region picture, randomly generating verification code characters in the verification code character region picture, adding an interference rule to the verification code characters to obtain a verification code common to the person and the legal equipment, and realizing the verification common to the person and the legal equipment. The verification code generated by the invention not only can realize the universality between people and legal equipment, but also can ensure that the identification speed of the equipment is higher and the authentication efficiency is high.

Description

Generation method, verification method and device of universal verification code of human and legal equipment
Technical Field
The invention relates to the technical field of image processing, in particular to a generation method, a verification method and a device of a universal verification code for people and legal equipment.
Background
The verification code is that a string of randomly generated numbers or symbols is used for generating a picture, some interference factors are added into the picture, character information in the picture is recognized by naked eyes of a user, an input form is submitted to a website for verification, and only when the verification is successful, a certain function can be used.
Identifying the verification code picture: the captcha technology is designed to distinguish a human from a computer, and recognizes a captcha by using the non-imitability of the human brain. The computer has high recognition difficulty, and people can easily recognize the computer. The device generally needs to identify the verification code picture according to the following sequence: graying, binarization, denoising, character segmentation and character recognition. The graying processing refers to a process of converting a color image containing brightness and color into a grayscale image; the character segmentation is to segment the verification code picture by taking the verification code characters as a target in the verification code picture, and finally obtain a plurality of verification code character images.
In the existing image verification code identification method, the identification process is complex, the efficiency is not high, and the accuracy of identifying the verification code by a person is difficult to achieve under the condition of more interference.
Disclosure of Invention
The present invention provides a method for generating a picture verification code, a method for verifying the picture verification code, and a corresponding device, so as to solve the problems in the background art.
In order to achieve the above object, the present invention provides a method for generating a picture verification code, including:
generating a first background picture of a verification code, and storing generation time data of the first background picture;
encoding the generated time data by adopting a preset encoding rule to obtain time encoded data corresponding to the generated time data;
dividing a plurality of time region pictures from the first background picture, and preprocessing each time region picture according to the time coding data to obtain a second background picture;
and carrying out region division on the second background picture to obtain a plurality of verification code character region pictures, randomly generating verification code characters in each verification code character region picture, and adding a preset interference rule to the verification code characters to obtain a universal verification code for people and legal equipment.
Further, preferably, the encoding the generation time by using a preset encoding rule to obtain a time code corresponding to the generation time includes:
preprocessing the generated time data to obtain second generated time data; wherein the pre-processing comprises: dividing the generation time into a number of years, a number of months, a number of days, and a first number of minutes, wherein the first number of minutes includes a number of hours and a number of minutes; adding the years and the first minutes, and combining the years and the first minutes with the months and the days to obtain second generation time data;
dividing the second generation time data by a preset numerical value to obtain third generation time data; wherein the preset data is a numerical value of four digits and above;
adding the numerical values of the first four bits of the integer part and the fractional part of the third generated time data to obtain an addition result, and using the first four bits of the addition result as the generated time data corresponding to time coding.
Further, preferably, the dividing the first background picture into a plurality of time region pictures, and preprocessing each of the time regions of the background picture according to the time-coded data to obtain a second background picture includes:
dividing a plurality of first time region pictures from the first background picture, and carrying out graying and binarization processing on each time region picture according to a preset rule to obtain a plurality of second time region pictures;
adjusting RGB values of pixel points of the first time region picture according to the time coding data and the number of black pixel points in the second time region picture, so that the number of black pixel points of a plurality of background picture time regions subjected to graying and binarization processing according to a preset rule corresponds to the time coding data;
and taking the adjusted first time region picture as a final time region picture, and combining the picture region part which is not divided in the first background picture to form a second background picture.
Further, as a preferred embodiment, the performing region division on the second background picture to obtain a plurality of verification code character region pictures, randomly generating verification code characters in each verification code character region picture, and adding a preset interference rule to the verification code characters to obtain a verification code common to a person and a legal device includes:
a verification code character table is constructed in advance, and the verification code character table comprises: identifying code characters and the number of black pixel points corresponding to the identifying code characters;
performing region division on the second background picture to obtain a plurality of verification code character region pictures;
randomly selecting characters from the verification code character table, writing the characters into each verification code character area picture, and adding interference noise points and interference lines;
adjusting the RGB values of the pixel points in the verification code character region picture to ensure that the number of black pixel points of the verification code character region picture after graying and binarization processing according to a preset rule is equal to the number of black pixel points corresponding to the verification code characters;
and taking the verification code character area picture after adjustment as a final verification code character area picture, and combining other area parts of the second background picture to form a universal verification code for the human and legal equipment.
The invention also provides a verification method of the universal verification code of the person and the legal equipment, which is applied to the verification of the verification code generated by the generation method of the universal verification code of the person and the legal equipment, and the verification method comprises the following steps:
generating legal equipment according to a preset registration rule, and acquiring information data of a verification code picture, wherein the information data comprises: graying parameters and binarization parameters of the verification code picture, region division information of the verification code picture and a verification code character association table;
acquiring a time code corresponding to the generation time of the verification code background picture according to the area division information of the verification code picture and the graying parameter and the binarization parameter of the verification code picture;
acquiring characters of the verification code according to the graying parameters, the binarization parameters, the region division information of the verification code picture and a verification code character association table of the verification code picture;
and judging whether the verification code is correct or not according to the generation time of the verification code background picture and the characters of the verification code.
The invention also provides a device for generating the verification code, which comprises: the device comprises a generating module, a coding module, a preprocessing module and an obtaining module, wherein the generating module is used for generating a code;
the generation module is used for generating a first background picture of the verification code and storing generation time data of the first background picture;
the encoding module is used for encoding the generated time data by adopting a preset encoding rule to obtain time encoding data corresponding to the generated time data;
the preprocessing module is used for dividing the first background picture into a plurality of time region pictures, and preprocessing each time region picture according to the time coding data to obtain a second background picture;
the acquisition module is used for carrying out region division on the second background picture to obtain a plurality of verification code character region pictures, randomly generating verification code characters in each verification code character region picture, and adding a preset interference rule to the verification code characters to obtain a universal verification code for people and legal equipment.
Further, preferably, the encoding module is specifically configured to:
preprocessing the generated time data to obtain second generated time data; wherein the pre-processing comprises: dividing the generation time into a number of years, a number of months, a number of days, and a first number of minutes, wherein the first number of minutes comprises a number of hours and a number of minutes; adding the years and the first minutes, and combining the years and the first minutes with the months and the days to obtain second generation time data;
dividing the second generation time data by a preset numerical value to obtain third generation time data; wherein the preset data is a numerical value of four digits and above;
adding the numerical values of the first four bits of the integer part and the fractional part of the third generated time data to obtain an addition result, and using the first four bits of the addition result as the generated time data corresponding to time coding.
Further, preferably, the preprocessing module is specifically configured to:
dividing a plurality of first time region pictures from the first background picture, and carrying out graying and binarization processing on each time region picture according to a preset rule to obtain a plurality of second time region pictures;
adjusting RGB values of pixel points of the first time region picture according to the time coding data and the number of black pixel points in the second time region picture, so that the number of black pixel points of a plurality of background picture time regions subjected to graying and binarization processing according to a preset rule corresponds to the time coding data;
and taking the adjusted first time region picture as a final time region picture, and combining the picture region part which is not divided in the first background picture to form a second background picture.
Further, preferably, the obtaining module is specifically configured to:
a verification code character table is constructed in advance, wherein the verification code character table comprises: identifying code characters and the number of black pixel points corresponding to the identifying code characters;
performing region division on the second background picture to obtain a plurality of verification code character region pictures;
randomly selecting characters from the verification code character table, writing the characters into each verification code character area picture, and adding interference noise points and interference lines;
adjusting the RGB values of the pixel points in the verification code character region picture to ensure that the number of black pixel points of the verification code character region picture after graying and binaryzation according to a preset rule is equal to the number of black pixel points corresponding to the verification code character;
and taking the verification code character area picture after adjustment as a final verification code character area picture, and combining other area parts of the second background picture to form a universal verification code for the human and legal equipment.
The invention also provides a verification device of the universal verification code of the person and the legal equipment, which comprises the following steps: the device comprises an acquisition module, a time coding module, a character module and a verification module, wherein:
the acquisition module is used for generating legal equipment according to a preset registration rule and acquiring information data of a verification code picture, wherein the information data comprises: graying parameters and binarization parameters of the verification code picture, region division information of the verification code picture and a verification code character association table;
the decoding module is used for acquiring a time code corresponding to the generation time of the verification code background picture according to the region division information of the verification code picture and the graying parameter and the binarization parameter of the verification code picture;
the character module is used for acquiring characters of the verification code according to the graying parameters, the binarization parameters, the region division information and the verification code character association table of the verification code picture;
and the verification module is used for judging whether the verification code is correct or not according to the generation time of the verification code background picture and the characters of the verification code.
Compared with the prior art, the invention has the beneficial effects that:
1. a person can identify the verification code picture through naked eyes to obtain verification code character information, and equipment can also identify the verification code picture through a series of processing to obtain the verification code character information, so that the person and the equipment can obtain the same verification code information, and finally, the identity authentication method which can be commonly used by the person and the equipment is achieved. The verification code is used as an identity authentication method which is common to people and legal equipment, and compared with a user password, an intelligent card and the like in the prior art, the method is safer.
2. Compared with the identity authentication technology based on the equipment, the verification code technology has the advantages that in the identity authentication process of the equipment, the equipment identifies the verification code information and returns the verification code information to the server, the server verifies the verification code information firstly and verifies the account number and the password of the equipment, the processing workload of the server is effectively reduced, the true identity of the equipment can be better verified, and an attacker is prevented from carrying out violent attack.
3. Compared with the verification code which is directly applied to the server which can not resist replay attack and counterfeit in the identity authentication system, the method utilizes the conversion of the current time into the time code, writes the time code into four corners of the verification code picture and serves as the basis for generating the subsequent verification code picture. The equipment firstly identifies four corners of the verification code picture in the identity authentication process to obtain time codes, and the equipment pushes forwards for one minute based on the current time and the current time of the equipment to generate two time codes. The identified time codes and the two time codes generated by the equipment are verified, the verification code information identifying process is continued to be carried out on the verification code picture as long as one of the time codes generated by the equipment passes verification, otherwise, the identity authentication process is ended, and counterfeit servers and replay attacks can be effectively prevented. Finally, bidirectional authentication is realized, and replay attack, counterfeit servers and the like can be effectively resisted.
4. Compared with the prior art, the prior art treats the added interference information as invalid information. In the process of generating the verification code picture, the noise points and the interference lines are added into the interference information of the verification code picture, and the noise points and the interference lines are one of the characteristics of subsequent pictures for identification. The noise points and the interference lines are effective information, so that the identification difficulty of other equipment is increased, and the safety of the identity authentication of the verification code picture is improved.
5. Compared with the existing identifying code picture identification, the existing identifying code picture identification needs to experience: graying, binarization, denoising, image segmentation and character recognition. The identification process of the invention is as follows: area division, graying, binarization and character matching. The identification process of the invention omits the denoising treatment and modifies the sequence of the verification code picture. The verification code picture is divided into regions, graying and binaryzation are only needed to be carried out on the divided region picture, and the whole verification code picture does not need to be grayed and binaryzed, so that the equipment is high in identification speed and high in authentication efficiency, and the recognition of the OCR technology is effectively prevented from being cracked.
6. In the area division and character recognition, according to the rule agreed by both parties, the image is subjected to area division, graying processing and binarization processing in a set area, finally a black-white image is generated, black pixel points in black and white are counted, and the obtained pixel points are corresponding to a character association table in the set rule to determine what characters are. The pairing is convenient and fast, operations such as template matching and the like are not needed to be carried out on the characters, the equipment is operated, and the method is fast and effective.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for generating a verification code according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a verification method for a verification code according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for generating a verification code according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an apparatus for verifying a verification code according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be understood that the step numbers used herein are for convenience of description only and are not intended as limitations on the order in which the steps are performed.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
The terms "comprises" and "comprising" indicate the presence of the described 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.
The term "and/or" refers to and includes any and all possible combinations of one or more of the associated listed items.
Referring to fig. 1, an embodiment of the invention provides a method for generating a picture verification code. As shown in fig. 1, the method for generating a picture verification code includes steps S10 to S40. The method comprises the following steps:
and S10, generating a first background picture of the verification code, and storing the generation time data of the first background picture.
Specifically, the response device or the user initiates an identity authentication request, and after receiving the identity authentication request, the server reads a picture randomly generated or stored by the server, and uses the picture as a first background picture of the verification code, and stores generation time data of the first background picture.
And S20, encoding the generated time data by adopting a preset encoding rule to obtain time encoding data corresponding to the generated time data.
Specifically, preprocessing the generated time data to obtain second generated time data; wherein the pre-processing comprises: dividing the generation time into a number of years, a number of months, a number of days, and a first number of minutes, wherein the first number of minutes includes a number of hours and a number of minutes; adding the years and the first minutes, and combining the years and the first minutes with the months and the days to obtain second generation time data;
dividing the second generation time data by a preset numerical value to obtain third generation time data; wherein the preset data is a numerical value of four digits and above;
adding the numerical values of the first four bits of the integer part and the fractional part of the third generated time data to obtain an addition result, and using the first four bits of the addition result as the generated time data corresponding to time coding.
For example: the current time is 11 minutes (202110231511) at 10 months, 23 days, 15 hours in 2021, and the number of hours is multiplied by 60 and added to the number of minutes, 911. Then 911 is added to the number of years, i.e. 911+2021 equals 2932. The combination with the month and day is 29321023, and finally divided by a larger approximate number (e.g. 8888), the quotient F is 3297.8198694, the integer 3297 of the quotient F is added to the first four bits 8198 of the decimal number of the quotient F to obtain a result J of 11495, and the last four bits of the result J are taken to obtain a time code of 1495.
It should be noted that, when the integer part or the decimal part is less than four digits, zero padding is used to form four digits.
And S30, dividing the first background picture into a plurality of time region pictures, and preprocessing each time region picture according to the time coding data to obtain a second background picture.
Specifically, a plurality of first time region pictures are divided from the first background picture, and graying and binarization processing are performed on each time region picture to obtain a plurality of second time region pictures;
preferably, four corners in the first background picture are divided into four M × M area pictures Ai, and the area pictures at the upper left corner, the lower left corner, the upper right corner and the lower right corner are respectively a1, a2, A3 and a 4. The correspondence of the time codes P1, P2, P3, and P4 written in the region pictures a1, a2, A3, and a4 is clarified.
For example: assuming that the time code is 1495, taking M to be 5, and dividing the area into 5 by 5; dividing four corners of the picture: the upper left corner is the first to fifth rows and the first to fifth columns. The upper right corner is the first to fifth rows and the penultimate to fifth columns. The bottom right corner is from the last-but-one row to the last-but-one row, and from the last-but-one column to the last-five column. The bottom left corner is the first to fifth last rows and the first to fifth columns. Step one, obtaining a time code as 1495, wherein a first numerical value 1 in the time code is in a corresponding relation with the picture of the upper left corner region, a second numerical value 4 is in a corresponding relation with the picture of the upper right corner region, a third numerical value 9 is in a corresponding relation with the picture of the lower right corner region, and a fourth numerical value 5 is in a corresponding relation with the picture of the lower left corner region.
And adjusting the RGB values of the pixels of the first time region picture according to the time coding data and the number of black pixels in the second time region picture, so that the number of black pixels subjected to graying and binarization in a plurality of background picture time regions corresponds to the time coding data.
Specifically, the second time region picture is weighted according to a preset weight value W R 、W G 、W B And a threshold value T, carrying out graying and binarization processing; and then circularly counting whether the black pixel points in each second time region picture are equal to the corresponding time coding data or not, if not, randomly adjusting the RGB values of the black pixel points in the second time region picture, so that the number of the black pixel points of each second time region picture after graying and binarization processing in the region is equal to the corresponding time coding data.
And taking the adjusted first time region picture as a final time region picture, and combining the picture region part which is not divided in the first background picture to form a second background picture.
S40, carrying out region division on the second background picture to obtain a plurality of verification code character region pictures, randomly generating verification code characters in each verification code character region picture, and adding a preset interference rule to the verification code characters to obtain a universal verification code for people and legal equipment.
Specifically, a verification code character table is constructed in advance, and the verification code character table comprises: identifying code characters and the number of black pixel points corresponding to the identifying code characters;
performing region division on the second background picture to obtain a plurality of verification code character region pictures;
it should be noted that, dividing the range of the image in the character region of the captcha for the second background image is to remove the range of the image in the time region in the above steps.
Randomly selecting characters from the verification code character table, writing the characters into each verification code character area picture, and adding interference noise points and interference lines;
adjusting the RGB values of the pixel points in the verification code character region picture to ensure that the number of black pixel points of the verification code character region picture subjected to graying and binarization processing by a preset rule is equal to the number of black pixel points corresponding to the verification code characters;
it should be noted that the preset rule specifically means that parameter values in the graying and binarization processing processes can be set according to actual situations, for example: graying parameter W R 、W G 、W B (ii) a A binarization parameter T, etc.
And taking the verification code character area picture after adjustment as a final verification code character area picture, and combining other area parts of the second background picture to form a universal verification code for the human and legal equipment.
Compared with the prior art, the verification code generation method provided by the invention has the beneficial effects that:
the method utilizes the conversion of the current time into the time code, writes the time code into four corners of the verification code picture, and serves as the basis for generating the subsequent verification code picture. The equipment firstly identifies four corners of the verification code picture in the identity authentication process to obtain time codes, and the equipment pushes forwards for one minute based on the current time and the current time of the equipment to generate two time codes. The identified time codes and the two time codes generated by the equipment are verified, the verification code information identifying process is continued to be carried out on the verification code picture as long as one of the time codes generated by the equipment passes verification, otherwise, the identity authentication process is ended, and counterfeit servers and replay attacks can be effectively prevented. Finally, bidirectional authentication is realized, and replay attack, counterfeit servers and the like can be effectively resisted.
As shown in fig. 2, the present invention further provides a verification method for a verification code, which is applied to verify the verification code generated by the verification code generation method described in any one of the above, where the verification method includes:
s100, obtaining information data of the verification code, wherein the information data comprises: the time region picture range of the verification code and the character region picture of the verification code;
specifically, after receiving the verification code picture, the device reads parameters in the device storage module, such as: time picture region division parameter, numerical value of initialization time coding array L and weight W in graying processing R 、W G And W B A threshold value T in the binarization processing, a loop initial value i of 1, and the like.
S110, acquiring time coding data corresponding to the generation time of the verification code background picture according to the time region picture of the verification code;
specifically, four corners in the verification code picture are divided to obtain four area pictures, namely a1, a2, A3 and A4, graying and binarization processing are performed on the 4 area pictures respectively, the numbers of black pixels L1, L2, L3 and L4 in the four area pictures of a1, a2, A3 and A4 are calculated, and the four area pictures are combined according to character connection to obtain time coding data.
S120, acquiring characters of the verification code according to the character area picture of the verification code;
specifically, a character region picture of the verification code is obtained, graying and binarization processing are respectively carried out on the character region picture, the number of black pixel points of each character region picture is calculated, the characters of the verification code are obtained according to a character association table, and verification code information is generated.
S130, judging whether the verification code is correct or not according to the generation time of the verification code background picture and the characters of the verification code.
Compared with the prior art, the verification method of the verification code provided by the invention has the beneficial effects that:
the identification process of the invention omits the denoising treatment and modifies the sequence of the verification code picture. The verification code picture is divided into regions, graying and binaryzation are only needed to be carried out on the divided region picture, and the whole verification code picture does not need to be grayed and binaryzed, so that the equipment is high in identification speed and high in authentication efficiency, and the recognition of the OCR technology is effectively prevented from being cracked.
As shown in fig. 3, the present invention further provides an apparatus 200 for generating a verification code, including: the device comprises a generation module 201, an encoding module 202, a preprocessing module 203 and an acquisition module 204, wherein;
the generating module 201 is configured to generate a first background picture of the verification code, and store generation time data of the first background picture;
the encoding module 202 is configured to encode the generated time data by using a preset encoding rule, so as to obtain time-encoded data corresponding to the generated time data;
the preprocessing module 203 is configured to divide the first background picture into a plurality of time region pictures, and preprocess each time region picture according to the time-coded data to obtain a second background picture;
the obtaining module 204 is configured to perform region division on the second background picture to obtain a plurality of verification code character region pictures, and randomly generate verification code characters in each verification code character region picture to obtain a verification code.
In an embodiment of the present invention, the encoding module is specifically configured to:
preprocessing the generated time data to obtain second generated time data; wherein the pre-processing comprises: dividing the generation time into a number of years, a number of months, a number of days, and a first number of minutes, wherein the first number of minutes includes a number of hours and a number of minutes; adding the years and the first minutes, and combining the years and the first minutes with the months and the days to obtain second generation time data;
dividing the second generation time data by a preset numerical value to obtain third generation time data; wherein the preset data is a numerical value of four digits and above;
adding the numerical values of the first four bits of the integer part and the fractional part of the third generated time data to obtain an addition result, and using the first four bits of the addition result as the generated time data corresponding to time coding.
In an embodiment of the present invention, the preprocessing module is specifically configured to:
dividing a plurality of first time region pictures from the first background picture, and carrying out graying and binarization processing on each time region picture to obtain a plurality of second time region pictures;
adjusting RGB values of pixel points of the first time region picture according to the time coding data and the number of black pixel points in the second time region picture, so that the number of black pixel points of a plurality of background picture time regions subjected to graying and binarization processing according to a preset rule corresponds to the time coding data;
and taking the adjusted first time region picture as a final time region picture, and combining the picture region part which is not divided in the first background picture to form a second background picture.
In an embodiment of the present invention, the obtaining module is specifically configured to:
a verification code character table is constructed in advance, and the verification code character table comprises: identifying code characters and the number of black pixel points corresponding to the identifying code characters;
carrying out region division on the second background picture to obtain a plurality of verification code character region pictures;
randomly selecting characters from the verification code character table, writing the characters into each verification code character area picture, and adding interference noise points and interference lines;
adjusting the RGB values of the pixel points in the verification code character region picture to ensure that the number of black pixel points of the verification code character region picture after graying and binarization processing according to a preset rule is equal to the number of black pixel points corresponding to the verification code characters;
and taking the verification code character area picture after adjustment as a final verification code character area picture, and combining other area parts of the second background picture to form a universal verification code for the human and legal equipment.
As shown in fig. 4, the present invention further provides an apparatus 300 for verifying a verification code, comprising: an acquisition module 301, a decoding module 302, a character module 303 and a verification module 304, wherein;
the obtaining module 301 is configured to generate a legal device according to a preset registration rule, and obtain information data of a verification code picture, where the information data includes: graying parameters and binarization parameters of the verification code picture, region division information of the verification code picture and a verification code character association table;
the time coding module 302 is configured to obtain a time code corresponding to the generation time of the verification code background picture according to the region division information of the verification code picture and the graying parameter and the binarization parameter of the verification code picture;
the character module 303 is configured to obtain characters of the verification code according to the graying parameter of the verification code picture, the binarization parameter, the region division information of the verification code picture, and the verification code character association table;
the verification module 304 is configured to determine whether the verification code is correct according to the generation time of the verification code background picture and the characters of the verification code.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

Claims (8)

1. A method for generating a universal verification code for people and legal equipment is characterized by comprising the following steps:
generating a first background picture of a verification code, and storing generation time data of the first background picture;
encoding the generated time data by adopting a preset encoding rule to obtain time encoded data corresponding to the generated time data;
dividing a plurality of time region pictures from the first background picture, and preprocessing each time region picture according to the time coding data to obtain a second background picture, wherein the second background picture comprises the time region pictures; dividing a plurality of first time region pictures from the first background picture, and carrying out graying and binarization processing on each time region picture according to a preset rule to obtain a plurality of second time region pictures; adjusting RGB values of pixels of the first time region picture according to the time coding data and the number of black pixels in the second time region picture, so that the number of black pixels of a plurality of background picture time regions subjected to graying and binarization processing according to a preset rule corresponds to the time coding data; taking the adjusted first time region picture as a final time region picture, and combining the picture region part which is not divided in the first background picture to form a second background picture;
and carrying out region division on the second background picture to obtain a plurality of verification code character region pictures, randomly generating verification code characters in each verification code character region picture, and adding a preset interference rule to the verification code characters to obtain a universal verification code for people and legal equipment.
2. The method for generating the universal verification code for the person and the legal device according to claim 1, wherein the encoding the generation time according to a preset encoding rule to obtain the time code corresponding to the generation time comprises:
preprocessing the generated time data to obtain second generated time data; wherein the pre-processing comprises: dividing the generation time into a number of years, a number of months, a number of days, and a first number of minutes, wherein the first number of minutes includes a number of hours and a number of minutes; adding the years and the first minutes, and combining the years and the first minutes with the months and the days to obtain second generation time data;
dividing the second generation time data by a preset numerical value to obtain third generation time data; wherein the preset data is a numerical value of four digits and above;
adding the numerical values of the first four bits of the integer part and the fractional part of the third generated time data to obtain an addition result, and using the first four bits of the addition result as the generated time data corresponding to time coding.
3. The method for generating the verification code common to the person and the legal device according to claim 1, wherein the dividing the second background picture into regions to obtain a plurality of verification code character region pictures, randomly generating verification code characters in each verification code character region picture, and adding a preset interference rule to the verification code characters to obtain the verification code common to the person and the legal device comprises:
a verification code character table is constructed in advance, and the verification code character table comprises: identifying code characters and the number of black pixel points corresponding to the identifying code characters;
performing region division on the second background picture to obtain a plurality of verification code character region pictures;
randomly selecting characters from the verification code character table, writing the characters into each verification code character area picture, and adding interference noise points and interference lines;
adjusting the RGB values of the pixel points in the verification code character region picture to ensure that the number of black pixel points of the verification code character region picture after graying and binarization processing according to a preset rule is equal to the number of black pixel points corresponding to the verification code characters;
and taking the adjusted verification code character region picture as a final verification code character region picture, and combining other region parts of the second background picture to form a universal verification code for the human and legal equipment.
4. A verification method of a verification code common to a person and a legal device, applied to verify the verification code generated by the verification code generation method common to the person and the legal device as claimed in claim 3, wherein the verification method comprises:
generating legal equipment according to a preset registration rule, and acquiring information data of a verification code picture, wherein the information data comprises: graying parameters and binarization parameters of the verification code picture, region division information of the verification code picture and a verification code character association table;
acquiring a time code corresponding to the generation time of the verification code background picture according to the area division information of the verification code picture and the graying parameter and the binarization parameter of the verification code picture;
acquiring characters of the verification code according to the graying parameters, the binarization parameters, the region division information of the verification code picture and a verification code character association table of the verification code picture;
and judging whether the verification code is correct or not according to the time code corresponding to the generation time of the verification code background picture and the characters of the verification code.
5. A generation device for a universal verification code of a person and legal equipment is characterized by comprising: the device comprises a generation module, a coding module, a preprocessing module and an acquisition module, wherein:
the generation module is used for generating a first background picture of the verification code and storing generation time data of the first background picture;
the encoding module is used for encoding the generated time data by adopting a preset encoding rule to obtain time encoding data corresponding to the generated time data;
the preprocessing module is configured to divide the first background picture into a plurality of time region pictures, and preprocess each time region picture according to the time-coded data to obtain a second background picture, and specifically is configured to: dividing a plurality of first time region pictures from the first background picture, and carrying out graying and binarization processing on each time region picture according to a preset rule to obtain a plurality of second time region pictures; adjusting RGB values of pixel points of the first time region picture according to the time coding data and the number of black pixel points in the second time region picture, so that the number of black pixel points of a plurality of background picture time regions subjected to graying and binarization processing according to a preset rule corresponds to the time coding data; taking the adjusted first time region picture as a final time region picture, and combining the picture region part which is not divided in the first background picture to form a second background picture;
the acquisition module is used for carrying out region division on the second background picture to obtain a plurality of verification code character region pictures, randomly generating verification code characters in each verification code character region picture, and adding a preset interference rule to the verification code characters to obtain a universal verification code for people and legal equipment.
6. The apparatus for generating the universal verification code for human and legal devices as claimed in claim 5, wherein the encoding module is specifically configured to:
preprocessing the generated time data to obtain second generated time data; wherein the pre-processing comprises: dividing the generation time into a number of years, a number of months, a number of days, and a first number of minutes, wherein the first number of minutes includes a number of hours and a number of minutes; adding the years and the first minutes, and combining the years and the first minutes with the months and the days to obtain second generation time data;
dividing the second generation time data by a preset numerical value to obtain third generation time data; wherein the preset data is a numerical value of four digits and above;
adding the numerical values of the first four bits of the integer part and the fractional part of the third generated time data to obtain an addition result, and time-coding the first four bits of the addition result as the generated time data.
7. The apparatus for generating the universal verification code for the person and the legal device according to claim 5, wherein the obtaining module is specifically configured to:
a verification code character table is constructed in advance, and the verification code character table comprises: identifying code characters and the number of black pixel points corresponding to the identifying code characters;
performing region division on the second background picture to obtain a plurality of verification code character region pictures;
randomly selecting characters from the verification code character table, writing the characters into each verification code character area picture, and adding interference noise points and interference lines;
adjusting the RGB values of the pixel points in the verification code character region picture to ensure that the number of black pixel points of the verification code character region picture after graying and binarization processing according to a preset rule is equal to the number of black pixel points corresponding to the verification code characters;
and taking the verification code character area picture after adjustment as a final verification code character area picture, and combining other area parts of the second background picture to form a universal verification code for the human and legal equipment.
8. A verification apparatus for a passcode common to a person and a legitimate device, which is used for verifying the passcode generated by the passcode generation apparatus common to a person and a legitimate device according to claim 7, comprising: the device comprises an acquisition module, a decoding module, a character module and a verification module, wherein:
the acquisition module is used for generating legal equipment according to a preset registration rule and acquiring information data of a verification code picture, wherein the information data comprises: graying parameters of the verification code picture, binarization parameters, region division information of the verification code picture and a verification code character association table;
the decoding module is used for acquiring a time code corresponding to the generation time of the verification code background picture according to the region division information of the verification code picture and the graying parameter and the binarization parameter of the verification code picture;
the character module is used for acquiring characters of the verification code according to the graying parameters, the binarization parameters, the region division information and the verification code character association table of the verification code picture;
and the verification module is used for judging whether the verification code is correct or not according to the time code corresponding to the generation time of the verification code background picture and the characters of the verification code.
CN202210051928.7A 2022-01-17 2022-01-17 Generation method, verification method and device of universal verification code of human and legal equipment Active CN114494474B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210051928.7A CN114494474B (en) 2022-01-17 2022-01-17 Generation method, verification method and device of universal verification code of human and legal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210051928.7A CN114494474B (en) 2022-01-17 2022-01-17 Generation method, verification method and device of universal verification code of human and legal equipment

Publications (2)

Publication Number Publication Date
CN114494474A CN114494474A (en) 2022-05-13
CN114494474B true CN114494474B (en) 2022-09-20

Family

ID=81512556

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210051928.7A Active CN114494474B (en) 2022-01-17 2022-01-17 Generation method, verification method and device of universal verification code of human and legal equipment

Country Status (1)

Country Link
CN (1) CN114494474B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101236561A (en) * 2007-01-31 2008-08-06 株式会社理光 Coding device, data searching and image processing device, data searching and image processing system, and data searching and image processing method
CN102831568A (en) * 2012-08-03 2012-12-19 网易(杭州)网络有限公司 Method and device for generating verification code picture
CN104346557A (en) * 2013-08-06 2015-02-11 深圳市腾讯计算机系统有限公司 Verification code generation method and device and verification code display control method and device
CN104778432A (en) * 2014-01-10 2015-07-15 携程计算机技术(上海)有限公司 Image recognition method
CN104852889A (en) * 2014-02-18 2015-08-19 腾讯科技(深圳)有限公司 Picture identifying code generation method and system, and verify method and client side, and server
CN107908946A (en) * 2017-10-27 2018-04-13 链家网(北京)科技有限公司 Method for generating picture verification codes, picture validation code, verification method and device
CN111259365A (en) * 2020-01-10 2020-06-09 河北先见软件科技股份有限公司 Dynamic verification code generation method
EP3690686A1 (en) * 2019-02-01 2020-08-05 Idemia Identity & Security France Authentication procedure, server and electronic identity device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7313251B2 (en) * 1993-11-18 2007-12-25 Digimarc Corporation Method and system for managing and controlling electronic media

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101236561A (en) * 2007-01-31 2008-08-06 株式会社理光 Coding device, data searching and image processing device, data searching and image processing system, and data searching and image processing method
CN102831568A (en) * 2012-08-03 2012-12-19 网易(杭州)网络有限公司 Method and device for generating verification code picture
CN104346557A (en) * 2013-08-06 2015-02-11 深圳市腾讯计算机系统有限公司 Verification code generation method and device and verification code display control method and device
CN104778432A (en) * 2014-01-10 2015-07-15 携程计算机技术(上海)有限公司 Image recognition method
CN104852889A (en) * 2014-02-18 2015-08-19 腾讯科技(深圳)有限公司 Picture identifying code generation method and system, and verify method and client side, and server
CN107908946A (en) * 2017-10-27 2018-04-13 链家网(北京)科技有限公司 Method for generating picture verification codes, picture validation code, verification method and device
EP3690686A1 (en) * 2019-02-01 2020-08-05 Idemia Identity & Security France Authentication procedure, server and electronic identity device
CN111259365A (en) * 2020-01-10 2020-06-09 河北先见软件科技股份有限公司 Dynamic verification code generation method

Also Published As

Publication number Publication date
CN114494474A (en) 2022-05-13

Similar Documents

Publication Publication Date Title
US9805296B2 (en) Method and apparatus for decoding or generating multi-layer color QR code, method for recommending setting parameters in generation of multi-layer QR code, and product comprising multi-layer color QR code
US10210388B2 (en) Biometric template security and key generation
Wan et al. Visual Secret Sharing Scheme for (k, n) Threshold-Based on QR Code with Multiple Decryptions
WO2015192669A1 (en) Two-dimensional code scanning positioning prompt method and system
CN111008923A (en) Watermark embedding method, watermark extracting method, watermark embedding device, watermark extracting device and watermark extracting equipment
CN103929425A (en) Identity registration and identity authentication method, device and system
CN111292219A (en) Method for realizing hidden watermark of picture image data
WO2015062441A1 (en) Cgi web interface multi-session verification code generation and verification method
CN107845118A (en) A kind of digitization image processing method
CN113538197A (en) Watermark extraction method, device, storage medium and electronic equipment
CN109816077A (en) A kind of hidden method of two-dimensional barcode information, device, electronic equipment and storage medium
CN114494474B (en) Generation method, verification method and device of universal verification code of human and legal equipment
CN108271027A (en) A kind of extracting method of image adaptive secret information
CN105427234A (en) Sharing method and sharing system for WIFI password
Czajka et al. Verification of iris image authenticity using fragile watermarking
CN115526282A (en) Watermark encryption method, watermark extraction method, device and storage medium
CN105095704A (en) Identity recognition method based on multiple dynamic authentication
CN109840574B (en) Two-dimensional code information hiding method and device, electronic equipment and storage medium
EP1116176B1 (en) Information card
US20160342783A1 (en) Visual obfuscation security device, method and system
CN107481376B (en) Three-dimensional code unlocking method based on intelligent application
Mantoro et al. Real-time printed document authentication using watermarked qr code
CN116612572B (en) Building access control management system
CN113780029A (en) Verification method and device of novel three-dimensional code combined with portrait
CN110197246B (en) Self-anti-counterfeiting multi-dimensional bar code generation and verification method, device and system

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
GR01 Patent grant
GR01 Patent grant