Encrypted signature Algorithm (code) between PHP data

Source: Internet
Author: User
This article brings you the content is about PHP data encryption between the signature Algorithm (code), there is a certain reference value, the need for friends can refer to, I hope to help you.

    /**     * Signature generation algorithm     * @param  An associative array of the collection of request parameters for the array $params API call, does not contain the sign parameter     * @param  string $secret The signed key is the session returned when you get access token secret     * @return string returns the parameter signature value *    /Private Function getsignature ($params) {        $secret = $this->secretkey;        $str = ";  String        to be signed//the parameter is sorted in ascending order of the dictionary order of its parameter name        ksort ($params);        Iterates through each key/value of the sorted parameter array to        foreach ($params as $k + $v) {            //for Key/value to generate a key=value-formatted string, and stitching it $str after the string to be signed            . = $k. $v;        }        The signature key is stitched to the last face of the signature string        $str. = $secret;        Generate a MD5 signature for the signature string using the MD5 algorithm, which is the sign parameter value we want to append        return MD5 ($STR);    }

which

this->secretkey; It can be a two-program-ready encrypted character.

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.