How do you get the captcha?

Source: Internet
Author: User
Do not know whether your program is a network program, or a standalone program. If it is a local program, what do I need to verify the code? Superfluous. If it is a network program, please see below:

Above a few answers, from the surface is the implementation of the verification code, but the problem is local generation, local check, and server-independent, that also failed the actual function of the verification code, local display and other problems are easy to do.

The function of verification code is not only to verify your account and password, but also to verify that the server returned a random number, note: This random number is to be generated by the server, in order to ensure that the effective, is to verify that others can not use brute force to crack your network account and password. So now the problem is that in the program if you get the authentication information returned by the server, it is a picture in the web, however, whether it is applied in the Web or applied in the program, the authentication information should not be transmitted by characters and plaintext. Otherwise, the client can handle it on its own (no digital or character verification information will be uploaded to the web, all pictures). If it is a picture, the problem is converted, how the client program obtains the server-side picture and displays it (not through the Web protocol).

It's really difficult to achieve. As far as my personal opinion is concerned, it can be solved according to the following ideas:

The client first connects to the server side, when the client connects to the server, generates a random number, is stored in the CSocket information (the server always inherits CSocket or customizes a Socket class bar), and then sends back to the client and the random number related picture file (note is the picture file, Instead of verifying the character), the client resolves and displays the picture, and the client then asked the user for the account number, password, and verification code, and then logged in.

The above process only makes the verification code practical to use.

How do you get the captcha?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.