CN116775299A - Verification code picture acquisition method and device, electronic equipment and storage medium - Google Patents

Verification code picture acquisition method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116775299A
CN116775299A CN202310798525.3A CN202310798525A CN116775299A CN 116775299 A CN116775299 A CN 116775299A CN 202310798525 A CN202310798525 A CN 202310798525A CN 116775299 A CN116775299 A CN 116775299A
Authority
CN
China
Prior art keywords
verification code
picture
code picture
generated
reusable
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.)
Pending
Application number
CN202310798525.3A
Other languages
Chinese (zh)
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.)
Guangzhou Yihu Network Technology Co ltd
Original Assignee
Guangzhou Yihu Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Yihu Network Technology Co ltd filed Critical Guangzhou Yihu Network Technology Co ltd
Priority to CN202310798525.3A priority Critical patent/CN116775299A/en
Publication of CN116775299A publication Critical patent/CN116775299A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a verification code picture acquisition method, a verification code picture acquisition device, electronic equipment and a storage medium. The method is applied to the server, and comprises the following steps: acquiring a font file of a verification code picture to be generated and a background picture of the verification code picture to be generated; generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated; performing resource multiplexing processing on the verification code pictures to be processed to obtain a reusable verification code picture set; and responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set, and sending the target verification code picture to the client. According to the technical scheme, consumption of the CPU of the server is reduced, and the performance of the server is stable.

Description

Verification code picture acquisition method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method and apparatus for acquiring a verification code picture, an electronic device, and a storage medium.
Background
The verification code technology is to generate a picture from a series of numbers or symbols generated randomly, the picture is called a verification code picture, the user naked eyes identify characters in the verification code picture, the characters are submitted to a website, the website performs verification, and the user can use a certain function after the verification is successful.
Conventionally, when a large-volume request service is introduced to generate a verification code picture, there is a problem in that the server resource is consumed significantly, for example, CPU (Central Processing Unit) or disk IO (Input/Output) is consumed, and the server performance is degraded.
Disclosure of Invention
The application provides a verification code picture acquisition method, a verification code picture acquisition device, electronic equipment and a storage medium, which are used for reducing consumption of a CPU and solving the problem of performance degradation of a server.
According to an aspect of the present application, there is provided a method for acquiring a verification code picture, including:
acquiring a font file of a verification code picture to be generated and a background picture of the verification code picture to be generated;
generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated;
performing resource multiplexing processing on the verification code pictures to be processed to obtain a reusable verification code picture set;
and responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set, and sending the target verification code picture to the client.
According to another aspect of the present application, there is provided an apparatus for acquiring a verification code picture, including:
the data acquisition module is used for acquiring a font file of the verification code picture to be generated and a background picture of the verification code picture to be generated;
the verification code generation module is used for generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated;
the verification code multiplexing module is used for carrying out resource multiplexing processing on the verification code pictures to be processed to obtain a reusable verification code picture set;
the verification code acquisition module is used for responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set and sending the target verification code picture to the client.
According to another aspect of the present application, there is provided an electronic apparatus including:
at least one processor;
and a memory communicatively coupled to the at least one processor;
the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor, so that the at least one processor can execute the verification code picture acquisition method according to any embodiment of the present application.
According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement the method for acquiring a verification code picture according to any embodiment of the present application when executed.
According to the technical scheme, the to-be-processed verification code picture is generated according to the font file of the to-be-generated verification code picture and the background picture of the to-be-generated verification code picture, so that CPU consumption when a verification code picture acquisition request is received is reduced, resource multiplexing processing is further carried out on the to-be-processed verification code picture, verification code drawing times are reduced, consumption of a server CPU is reduced, a server acquires a target verification code picture from a reusable verification code picture set under the condition that the verification code picture acquisition request sent by a client is received, the target verification code picture is sent to the client, repeated use of the verification code picture is achieved, consumption of the server CPU is reduced, and stable server performance is guaranteed.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the application or to delineate the scope of the application. Other features of the present application will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a method for acquiring a verification code picture according to a first embodiment of the present application;
fig. 2 is a flowchart of a verification code picture obtaining method according to a second embodiment of the present application;
fig. 3 is a schematic flow chart of generating a verification code picture according to a second embodiment of the present application;
fig. 4 is a flowchart of a method for acquiring a verification code picture according to a third embodiment of the present application;
fig. 5 is a flowchart of a verification code picture obtaining method according to a fourth embodiment of the present application;
fig. 6 is a flowchart of a method for obtaining a verification code picture according to a fifth embodiment of the present application;
fig. 7A is a schematic diagram of a master slice and a slave slice according to a fifth embodiment of the present application;
FIG. 7B is a schematic diagram of a slice offset update according to a fifth embodiment of the present application;
fig. 7C is a schematic diagram of a master-slave slice switching according to a fifth embodiment of the present application;
fig. 8 is a schematic structural diagram of a verification code picture obtaining device according to a fourth embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device implementing a verification code picture obtaining method according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a method for acquiring a verification code picture according to an embodiment of the present application, where the method may be performed by a verification code picture acquiring device, the verification code picture acquiring device may be implemented in hardware and/or software, and the verification code picture acquiring device may be configured in a server. As shown in fig. 1, the method includes:
s110, acquiring a font file of the verification code picture to be generated and a background picture of the verification code picture to be generated.
In this embodiment, the font file refers to numbers and/or symbols for generating the verification code picture, and exemplary font files may include arabic numbers in 0-9, english characters or chinese characters in a-Z, and the like. The background picture refers to a background picture used for generating the verification code picture, specifically, the color of the background picture can be randomly selected, and the background picture is generated according to the selected color of the background picture.
S120, generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated.
The verification code picture to be processed refers to the verification code picture which is drawn.
Specifically, the font file of the verification code picture to be generated can be directly drawn on the background picture of the verification code picture to be generated, so that the verification code picture to be processed is obtained.
And S130, carrying out resource multiplexing processing on the verification code picture to be processed to obtain a reusable verification code picture set.
Specifically, the verification code picture to be processed can be stored to a preset position to form a reusable verification code picture set for multiplexing selection. The preset location may be a data component, a server local hard disk, or a memory, which is not limited herein.
S140, responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set, and sending the target verification code picture to the client.
In this embodiment, after receiving the verification code picture acquisition request sent by the client, one verification code picture may be randomly selected from the reusable verification code picture set to be used as the target verification code picture, or the target verification code picture may be selected from the reusable verification code picture set according to the location identifier of the verification code picture, which is not limited herein.
According to the technical scheme, the to-be-processed verification code picture is generated according to the font file of the to-be-generated verification code picture and the background picture of the to-be-generated verification code picture, so that CPU consumption when a verification code picture acquisition request is received is reduced, resource multiplexing processing is further carried out on the to-be-processed verification code picture, verification code drawing times are reduced, consumption of a server CPU is reduced, a server acquires a target verification code picture from a reusable verification code picture set under the condition that the verification code picture acquisition request sent by a client is received, the target verification code picture is sent to the client, repeated use of the verification code picture is achieved, consumption of the server CPU is reduced, and stable server performance is guaranteed.
Example two
Fig. 2 is a flowchart of a method for obtaining a verification code picture according to a second embodiment of the present application, where the method of this embodiment may be combined with each of the alternatives in the method for obtaining a verification code picture provided in the foregoing embodiment. The verification code picture acquisition method provided by the embodiment is further optimized. Optionally, the obtaining the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated includes: loading a font file of the verification code picture to be generated in a font library into a memory, and not releasing the font file of the verification code picture to be generated; and obtaining the background picture of the verification code picture to be generated from a background picture library.
As shown in fig. 2, the method includes:
s210, loading a font file of the verification code picture to be generated in a font library into a memory, and not releasing the font file of the verification code picture to be generated.
S220, obtaining the background picture of the verification code picture to be generated from a background picture library.
S230, generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated.
And S240, carrying out resource multiplexing processing on the verification code picture to be processed to obtain a reusable verification code picture set.
S250, responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set, and sending the target verification code picture to the client.
For example, fig. 3 is a schematic flow chart of generating a verification code picture provided in this embodiment, specifically, the server may load a font file of the verification code picture to be generated in a font library into the memory, obtain a background picture of the verification code picture to be generated from the background picture library, and further consume the CPU to draw the font file of the verification code picture to be generated on the background picture of the verification code picture to be generated, so as to obtain the verification code picture to be processed.
According to the technical scheme, the font file of the verification code picture to be generated in the font library is loaded into the memory, the font file of the verification code picture to be generated is not released, and the disk IO can be effectively reduced.
Example III
Fig. 4 is a flowchart of a method for obtaining a verification code picture according to a third embodiment of the present application, where the method of this embodiment may be combined with each of the alternatives in the method for obtaining a verification code picture provided in the foregoing embodiment. The verification code picture acquisition method provided by the embodiment is further optimized. Optionally, the generating the verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated includes: responding to a verification code timing drawing task, and determining the offset position of fonts in a font file of the verification code picture to be generated; generating an interference line of the verification code picture to be generated; and drawing the fonts in the font file of the verification code picture to be generated onto the background picture of the verification code picture to be generated according to the offset positions of the fonts in the font file of the verification code picture to be generated, and drawing the interference lines of the verification code picture to be generated onto the background picture of the verification code picture to be generated to obtain the verification code picture to be processed.
As shown in fig. 4, the method includes:
s310, acquiring a font file of the verification code picture to be generated and a background picture of the verification code picture to be generated.
S320, responding to the verification code timing drawing task, and determining the offset position of the fonts in the font file of the verification code picture to be generated.
S330, generating the interference line of the verification code picture to be generated.
And S340, drawing the fonts in the font file of the verification code picture to be generated onto the background picture of the verification code picture to be generated according to the offset positions of the fonts in the font file of the verification code picture to be generated, and drawing the interference lines of the verification code picture to be generated onto the background picture of the verification code picture to be generated to obtain the verification code picture to be processed.
In this embodiment, the verification code timing drawing task is a verification code drawing task triggered when specified. It can be understood that by drawing the verification code pictures at fixed time, the CPU only consumes in preset time, so that the consumption times of the CPU are reduced. And by drawing the interference line of the verification code picture to be generated on the background picture of the verification code picture to be generated, the interference can be increased, and the difficulty of cracking the verification code is improved.
And S350, carrying out resource multiplexing processing on the verification code picture to be processed to obtain a reusable verification code picture set.
S360, responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set, and sending the target verification code picture to the client.
According to the technical scheme, the verification code pictures are drawn at fixed time, so that the CPU only consumes in preset time, and the consumption times of the CPU are reduced. And by drawing the interference line of the verification code picture to be generated on the background picture of the verification code picture to be generated, the interference can be increased, and the difficulty of cracking the verification code is improved.
Example IV
Fig. 5 is a flowchart of a method for obtaining a verification code picture according to a fourth embodiment of the present application, where the method of this embodiment may be combined with each of the alternatives in the method for obtaining a verification code picture provided in the foregoing embodiment. The verification code picture acquisition method provided by the embodiment is further optimized. Optionally, the resource multiplexing processing is performed on the to-be-processed verification code picture to obtain a reusable verification code picture set, which includes: and loading the verification code picture to be processed into a memory to obtain a reusable verification code picture set.
As shown in fig. 5, the method includes:
s410, acquiring a font file of the verification code picture to be generated and a background picture of the verification code picture to be generated.
S420, generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated.
S430, loading the verification code picture to be processed into a memory to obtain a reusable verification code picture set.
It should be noted that, the verification code picture to be processed generated in advance is loaded into the memory, when the verification code picture acquisition request sent by the client is received, the target verification code picture is acquired from the memory, the multiplexing of the verification code picture is realized, and the verification code picture does not need to be generated in real time, so that the consumption of the CPU of the server is reduced.
Optionally, after loading the verification code picture to be processed into the memory, the method further includes: and replacing the verification code pictures to be processed in the memory in response to the verification code timing elimination task.
It can be understood that the verification code picture is dynamically changed by eliminating the verification code picture at regular time, so that verification is not easy to break, and verification safety is improved.
In some embodiments, when the verification code picture is eliminated at regular time, the memory block storing the verification code picture can be reset and put back into the resource pool, so as to avoid frequently applying for the memory.
S440, responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set, and sending the target verification code picture to the client.
According to the technical scheme, the verification code picture to be processed which is generated in advance is loaded into the memory, when the verification code picture acquisition request sent by the client is received, the target verification code picture is acquired from the memory, the verification code picture is multiplexed, and the verification code picture does not need to be generated in real time, so that the consumption of a CPU (Central processing unit) of the server is reduced.
Example five
Fig. 6 is a flowchart of a method for obtaining a verification code picture according to a fifth embodiment of the present application, where the method of this embodiment may be combined with each of the alternatives in the method for obtaining a verification code picture provided in the foregoing embodiment. The verification code picture acquisition method provided by the embodiment is further optimized. Optionally, the obtaining the target verification code picture from the reusable verification code picture set includes: and acquiring a slice offset, and acquiring a target verification code picture from the reusable verification code picture set based on the slice offset.
As shown in fig. 6, the method includes:
s510, acquiring a font file of the verification code picture to be generated and a background picture of the verification code picture to be generated.
S520, generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated.
And S530, carrying out resource multiplexing processing on the verification code picture to be processed to obtain a reusable verification code picture set.
S540, responding to a verification code picture acquisition request sent by a client, acquiring a slice offset, acquiring a target verification code picture from the reusable verification code picture set based on the slice offset, and sending the target verification code picture to the client.
The slice offset refers to a pointing offset of a slice, and may be used to obtain a target verification code picture. It should be noted that, the target verification code picture is obtained through the slice offset, complex calculation is not needed, and consumption of the CPU is reduced.
Optionally, obtaining the target captcha picture from the reusable captcha picture set based on the slice offset includes: updating the slice offset based on a preset time interval; and acquiring a target verification code picture from the reusable verification code picture set based on the updated slice offset.
It can be understood that by modifying or updating the slice offset, the acquired target verification code picture can be kept changed, and the verification security is improved.
Fig. 7A is a schematic diagram of a master slice and a slave slice provided in this embodiment, specifically, two slices may be initialized, and the slices may be used to point to a picture memory; one slice is a main slice and is used as an actual use; the other slice is a spare slice, and is switched as a spare, where fig. 1-8 are only examples of verification code pictures, and are not limiting. Fig. 7B is a schematic diagram of slice offset update provided in this embodiment, where slice offset may be updated periodically, so that a target verification code picture is obtained from a reusable verification code picture set according to the updated slice offset, so that the obtained target verification code picture remains unchanged. Fig. 7C is a schematic diagram of a primary-standby slice switching provided in the fifth embodiment, and specifically, the primary slice may be switched to the standby slice when the verification code picture in the standby slice is complemented.
In order to verify the effect of the verification code picture acquisition method, a push-down test comparison test is carried out, the test running environment is K8S, and the CPU core is limited to (request: 1, limit: 2) concurrency 4, and the total number is 2000. The query rate per second (QPS) of the existing verification code picture acquisition method is 44.49, 47.75, 47.47 and 47.87 respectively 4 seconds before; the verification code picture acquisition method QPS is 552.61, 538.69, 519.89 and 510.69 in the first 4 seconds respectively, so that the verification code picture acquisition method hardly affects a CPU and the server performance is stable.
According to the technical scheme provided by the embodiment of the application, the target verification code picture is acquired through the slice offset, complex calculation is not needed, and the consumption of a CPU is reduced.
Example six
Fig. 8 is a schematic structural diagram of an apparatus for acquiring a verification code picture according to a sixth embodiment of the present application. The verification code picture obtaining device is applied to a server, as shown in fig. 8, and the device comprises:
the data acquisition module 610 is configured to acquire a font file of a verification code picture to be generated and a background picture of the verification code picture to be generated;
the verification code generation module 620 is configured to generate a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated;
the verification code multiplexing module 630 is configured to perform resource multiplexing on the verification code picture to be processed to obtain a reusable verification code picture set;
and the verification code acquisition module 640 is configured to acquire a target verification code picture from the reusable verification code picture set in response to a verification code picture acquisition request sent by the client, and send the target verification code picture to the client.
According to the technical scheme, the to-be-processed verification code picture is generated according to the font file of the to-be-generated verification code picture and the background picture of the to-be-generated verification code picture, so that CPU consumption when a verification code picture acquisition request is received is reduced, resource multiplexing processing is further carried out on the to-be-processed verification code picture, verification code drawing times are reduced, consumption of a server CPU is reduced, a server acquires a target verification code picture from a reusable verification code picture set under the condition that the verification code picture acquisition request sent by a client is received, the target verification code picture is sent to the client, repeated use of the verification code picture is achieved, consumption of the server CPU is reduced, and stable server performance is guaranteed.
In some alternative embodiments, the data acquisition module 610 is specifically configured to:
loading a font file of the verification code picture to be generated in a font library into a memory, and not releasing the font file of the verification code picture to be generated;
and obtaining the background picture of the verification code picture to be generated from a background picture library.
In some alternative embodiments, the verification code generation module 620 is specifically configured to:
responding to a verification code timing drawing task, and determining the offset position of fonts in a font file of the verification code picture to be generated;
generating an interference line of the verification code picture to be generated;
and drawing the fonts in the font file of the verification code picture to be generated onto the background picture of the verification code picture to be generated according to the offset positions of the fonts in the font file of the verification code picture to be generated, and drawing the interference lines of the verification code picture to be generated onto the background picture of the verification code picture to be generated to obtain the verification code picture to be processed.
In some alternative embodiments, the identifying code multiplexing module 630 is specifically configured to:
and loading the verification code picture to be processed into a memory to obtain a reusable verification code picture set.
In some optional embodiments, the identifying code picture obtaining device further includes:
and the verification code elimination module is used for responding to the verification code timing elimination task and replacing the verification code pictures to be processed in the memory.
In some alternative embodiments, the verification code acquisition module 640 is specifically configured to:
the target verification code picture acquisition unit is used for acquiring a slice offset and acquiring a target verification code picture from the reusable verification code picture set based on the slice offset.
In some optional embodiments, the target captcha picture obtaining unit is further configured to:
updating the slice offset based on a preset time interval;
and acquiring a target verification code picture from the reusable verification code picture set based on the updated slice offset.
The verification code picture acquisition device provided by the embodiment of the application can execute the verification code picture acquisition method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method.
Example seven
Fig. 9 shows a schematic diagram of an electronic device 10 that may be used to implement an embodiment of the application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices (e.g., helmets, eyeglasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the applications described and/or claimed herein.
As shown in fig. 9, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An I/O interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the captcha picture acquisition method, which includes:
acquiring a font file of a verification code picture to be generated and a background picture of the verification code picture to be generated;
generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated;
performing resource multiplexing processing on the verification code pictures to be processed to obtain a reusable verification code picture set;
and responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set, and sending the target verification code picture to the client.
In some embodiments, the captcha picture acquisition method may be implemented as a computer program, which is tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the captcha picture acquisition method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the captcha picture acquisition method in any other suitable way (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present application, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present application are achieved, and the present application is not limited herein.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (10)

1. The verification code picture acquisition method is characterized by being applied to a server and comprising the following steps:
acquiring a font file of a verification code picture to be generated and a background picture of the verification code picture to be generated;
generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated;
performing resource multiplexing processing on the verification code pictures to be processed to obtain a reusable verification code picture set;
and responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set, and sending the target verification code picture to the client.
2. The method according to claim 1, wherein the obtaining a font file of a verification code picture to be generated and a background picture of the verification code picture to be generated includes:
loading a font file of the verification code picture to be generated in a font library into a memory, and not releasing the font file of the verification code picture to be generated;
and obtaining the background picture of the verification code picture to be generated from a background picture library.
3. The method of claim 1, wherein the generating a to-be-processed captcha picture based on the font file of the to-be-generated captcha picture and a background picture of the to-be-generated captcha picture comprises:
responding to a verification code timing drawing task, and determining the offset position of fonts in a font file of the verification code picture to be generated;
generating an interference line of the verification code picture to be generated;
and drawing the fonts in the font file of the verification code picture to be generated onto the background picture of the verification code picture to be generated according to the offset positions of the fonts in the font file of the verification code picture to be generated, and drawing the interference lines of the verification code picture to be generated onto the background picture of the verification code picture to be generated to obtain the verification code picture to be processed.
4. The method of claim 1, wherein the performing resource multiplexing on the to-be-processed captcha picture to obtain a reusable captcha picture set includes:
and loading the verification code picture to be processed into a memory to obtain a reusable verification code picture set.
5. The method of claim 4, wherein after loading the to-be-processed captcha picture into memory, the method further comprises:
and replacing the verification code pictures to be processed in the memory in response to the verification code timing elimination task.
6. The method of claim 1, wherein the obtaining the target captcha picture from the set of reusable captcha pictures comprises:
and acquiring a slice offset, and acquiring a target verification code picture from the reusable verification code picture set based on the slice offset.
7. The method of claim 6, wherein the obtaining a target captcha picture from the set of reusable captcha pictures based on the slice offset comprises:
updating the slice offset based on a preset time interval;
and acquiring a target verification code picture from the reusable verification code picture set based on the updated slice offset.
8. The verification code picture acquisition device is characterized by being applied to a server and comprising:
the data acquisition module is used for acquiring a font file of the verification code picture to be generated and a background picture of the verification code picture to be generated;
the verification code generation module is used for generating a verification code picture to be processed based on the font file of the verification code picture to be generated and the background picture of the verification code picture to be generated;
the verification code multiplexing module is used for carrying out resource multiplexing processing on the verification code pictures to be processed to obtain a reusable verification code picture set;
the verification code acquisition module is used for responding to a verification code picture acquisition request sent by the client, acquiring a target verification code picture from the reusable verification code picture set and sending the target verification code picture to the client.
9. An electronic device, the electronic device comprising:
at least one processor;
and a memory communicatively coupled to the at least one processor;
wherein the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the captcha picture retrieval method of any of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to implement the captcha picture retrieval method of any one of claims 1-7 when executed.
CN202310798525.3A 2023-06-30 2023-06-30 Verification code picture acquisition method and device, electronic equipment and storage medium Pending CN116775299A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310798525.3A CN116775299A (en) 2023-06-30 2023-06-30 Verification code picture acquisition method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310798525.3A CN116775299A (en) 2023-06-30 2023-06-30 Verification code picture acquisition method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116775299A true CN116775299A (en) 2023-09-19

Family

ID=88009762

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310798525.3A Pending CN116775299A (en) 2023-06-30 2023-06-30 Verification code picture acquisition method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116775299A (en)

Similar Documents

Publication Publication Date Title
CN111125057B (en) Method and device for processing service request and computer system
CN115964153A (en) Asynchronous task processing method, device, equipment and storage medium
CN116545905A (en) Service health detection method and device, electronic equipment and storage medium
CN116594563A (en) Distributed storage capacity expansion method and device, electronic equipment and storage medium
CN114564149B (en) Data storage method, device, equipment and storage medium
CN116661960A (en) Batch task processing method, device, equipment and storage medium
CN116069497A (en) Method, apparatus, device and storage medium for executing distributed task
CN116775299A (en) Verification code picture acquisition method and device, electronic equipment and storage medium
CN115543416A (en) Configuration updating method and device, electronic equipment and storage medium
CN114924806B (en) Dynamic synchronization method, device, equipment and medium for configuration information
CN116579914B (en) Execution method and device of graphic processor engine, electronic equipment and storage medium
CN115390992A (en) Virtual machine creating method, device, equipment and storage medium
CN115174447B (en) Network communication method, device, system, equipment and storage medium
CN116719621B (en) Data write-back method, device, equipment and medium for mass tasks
CN115599828A (en) Information processing method, device, equipment and storage medium
CN115391292A (en) Log data processing method, device, equipment and storage medium
CN115801718A (en) Message processing method and device, electronic equipment and message processing system
CN117081939A (en) Traffic data processing method, device, equipment and storage medium
CN114416040A (en) Page construction method, device, equipment and storage medium
CN118093211A (en) Distributed lock processing method, device, equipment and medium
CN116225437A (en) Page generation method and device, electronic equipment and storage medium
CN115687244A (en) File processing monitoring method, device, equipment and medium
CN116149792A (en) Virtual machine processing method and device, electronic equipment and storage medium
CN117033015A (en) Message processing method, device, system, equipment and storage medium
CN115600029A (en) Method, device, system, equipment and storage medium for displaying webpage

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