JavaScript does not use picture validation and server-side detection verification code methods

Source: Internet
Author: User
Tags hash md5

Web effects do not use picture validation and service-side detection verification code method

Many source code is to match the authentication code by requesting the server

It suddenly occurred to me that if the browser matches the ciphertext (on the page) after the SALT+MD5 mixed encryption, the local

Know if the verification code is correct

var seccode_hash = ' xxxxxx '; 32-Bit encrypted authentication code
var seccode_salt = ' xxsxxx '; Random characters
var seccode_count = 255; Number of encryption

When the user submits, the authentication code is encrypted and matched to the cipher:

8-bit English (case ignored) + number of verification code, poor lift about > 2 trillion

var hash = ' 12345678 ';
hash = MD5 (hash + seccode_salt);
for (var i = 0; i < Seccode_count; ++i) {
hash = MD5 (hash);
}
if (hash!= seccode_hash) {
Alert (' Authentication code Error! ');
}else{
Alert (' through ');
}

The validation code is submitted to the server in clear text and detected again on the service side

To refresh the authentication code, you need to request an interface via Ajax,
Returns the ciphertext of the new CAPTCHA, and the base64 of the Verification Code picture, which allows gzip compression to reduce traffic
Instead of using a URL request to verify code pictures

Related Article

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.