MD5 encryption and salt-adding encryption

Source: Internet
Author: User

This is MD5 encryption.

-(nsstring *) Md5hash

{

Const char *cstr = [self utf8string];

unsigned char result[];

cc_md5(cStr, strlen(cStr), result);

nsstring * string= [nsstring stringwithformat:

@ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",

result[0], result[1], result[2], result[3],

result[4], result[5], result[6], result[7],

result[8], result[9], result[,result[],

Result[], result[[] , result[], result[]];

return [string lowercasestring ]; This is the lowercase letter taken .

}

Adding salt means a secret key or a little bit of seasoning. In fact, the original string added a string of secret key and then use the top of the MD5 encryption to form a ciphertext because MD5 irreversible so commonly used to verify PWD

The general salt is such a pw= 123456

The salt value is pwd

Add salt is 123456{PWS}

The cipher that forms is 754dafae4bc423bcf7598eaac5a2abf7.

Ciphertext has 16 32 64 128 is actually the original cipher two processing and no other encryption in it

MD5 encryption and salt-adding encryption

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.