How PHP implements DES encryption algorithms that can interact with online encryption and decryption tools

Source: Internet
Author: User
Keywords PHP encryption algorithm des
Tags cast5 hmac mcrypt
Using PHP for DES encryption, encrypted ciphertext, can be decrypted on the DES Online encryption and decryption tool

Reply content:

Using PHP for DES encryption, encrypted ciphertext, can be decrypted on the DES Online encryption and decryption tool

    • Different encryption methods can be used to produce different results that can result in the final data being not universal although the same algorithm

PHP comes with Des and 3DES encryption and decryption

PHP Self-supported encryption method list (dependent mcrypt): Http://cn2.php.net/manual/zh/mcrypt.ciph ...

echo mcrypt_get_key_size(MCRYPT_DES,MCRYPT_MODE_CFB);// des cfb 秘钥长度为8位// 秘钥$key = 11111111;// 创建IV$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_DES, MCRYPT_MODE_CFB),MCRYPT_RAND);// 加密 使用CFB模式$data = mcrypt_encrypt(MCRYPT_DES, $key, '加密的数据', MCRYPT_MODE_CFB, $iv);var_dump($data);

In addition, the OpenSSL extension of PHP can also be used to encrypt related functions directly:openssl_encrypt

Gets the list of cryptographic parameters supported by OpenSSL Print_r (Openssl_get_cipher_methods ()); Array ([0] = AES-128-CBC [1] = AES-128-CFB [2] = AES-128-CFB1 [3] = = AES-128-CFB8 [4] = = aes-128-ctr [5] = AES-128-ECB [6] = AES-128-OFB [7] = = aes-128-xts [8] = = AES-192-CBC [9] =&G T AES-192-CFB [Ten] = AES-192-CFB1 [one] = aes-192-cfb8 [] = aes-192-ctr [] = AES-192-ECB [ [] = AES-192-OFB [[]] = AES-256-CBC [+] = AES-256-CFB [+] = AES-256-CFB1 [+] = AES-256 -cfb8 [] = aes-256-ctr [+] = AES-256-ECB [+] = AES-256-OFB [] = aes-256-xts [] =&gt ; BF-CBC [[] = BF-CFB [+] = BF-ECB [+] = BF-OFB [+] = CAMELLIA-128-CBC [] = Camelli A-128-CFB [+] = CAMELLIA-128-CFB1 [+] = camellia-128-cfb8 [+] = CAMELLIA-128-ECB [+] = + CAM ELLIA-128-OFB [[+] = CAMELLIA-192-CBC [+] = CAMELLIA-192-CFB [35] = [CAMELLIA-192-CFB1] = camellia-192-cfb8 [PNS] = CAMELLIA-192-ECB [] = CAMELLIA-192-OFB [MAX] = CAMELLIA-256-CBC [+] = CAMELLIA-256-CFB [in] = CAMELLIA-256-CFB1 [] = CAMELLIA-256-CFB 8 [[+] = CAMELLIA-256-ECB [] = CAMELLIA-256-OFB [[]] = CAST5-CBC [[47]] [+] [+]]/=& Gt CAST5-ECB [[] = CAST5-OFB [$] = DES-CBC [[] = DES-CFB [Wuyi] = des-cfb1 [*] = DES-CFB 8 [[+] = DES-ECB [si] = des-ede [+] = DES-EDE-CBC [[+] = DES-EDE-CFB [] = des-ede-of B [[+] = [DES-EDE3] = DES-EDE3-CBC [[]] [[+]] = DES-EDE3-CFB [+] = DES-EDE3-CFB1 [+] = D ES-EDE3-CFB8 [+] = DES-EDE3-OFB [+] = DES-OFB [67] = DESX-CBC [28147-89] = GOST > IDEA-CBC [[] [] = IDEA-CFB [] = IDEA-ECB [] = IDEA-OFB [[+] = RC2-40-CBC [] = RC2-64-CBC [73] => RC2-CBC [[] = RC2-CFB [] [] = RC2-ECB [[]] = RC2-OFB [All] = RC4 [+] = rc4-40 [  [+] = rc4-hmac-md5 [] = SEED-CBC [Bayi] = SEED-CFB [[+] = SEED-ECB [the] [] = SEED-OFB [84] = AES-128-CBC [] = AES-128-CCM [[+] = AES-128-CFB [All] [] = AES-128-CFB1 [+] = AES-128-CF B8 [[[]] = aes-128-ctr [All] = AES-128-ECB [the] [] = AES-128-GCM [the] [] = AES-128-OFB [] es-128-xts [94] = AES-192-CBC [up] = aes-192-ccm [] = AES-192-CFB [$] = AES-192-CFB1 [98 ] = [AES-192-CFB8] = aes-192-ctr [+] = AES-192-ECB [101] = AES-192-GCM [102] = aes-19 2-OFB [103] = AES-256-CBC [104] = AES-256-CCM [[+] = AES-256-CFB [106] = AES-256-CFB1 [107 ] [AES-256-CFB8] = [108] = aes-256-ctr [109] = AES-256-ECB [in] = AES-256-GCM [111] = Aes-2 56-OFB [+] = AEs-256-xts [113] = BF-CBC [[+] = BF-CFB [[+] = BF-ECB [] = BF-OFB [117] = camellia- 128-CBC [118] = CAMELLIA-128-CFB [119] = CAMELLIA-128-CFB1 [+] = camellia-128-cfb8 [121] = C AMELLIA-128-ECB [122] = CAMELLIA-128-OFB [123] = CAMELLIA-192-CBC [124] = CAMELLIA-192-CFB [125] =    > camellia-192-cfb1 [126] = CAMELLIA-192-CFB8 [127] = CAMELLIA-192-ECB [+] = CAMELLIA-192-OFB [129] = CAMELLIA-256-CBC [[]] = CAMELLIA-256-CFB [131] = CAMELLIA-256-CFB1 [PPI] = camellia-256    -CFB8 [133] = CAMELLIA-256-ECB [134] = CAMELLIA-256-OFB [135] = CAST5-CBC [136] = CAST5-CFB [137] = CAST5-ECB [138] = CAST5-OFB [139] = DES-CBC [+] = DES-CFB [141] = DES-CFB1 [    142] = Des-cfb8 [143] = DES-ECB [144] = Des-ede [145] + DES-EDE-CBC [146] = DES-EDE-CFB [147] = DES-EDE-OFB    [148] = des-ede3 [149] = DES-EDE3-CBC [] = DES-EDE3-CFB [151] = DES-EDE3-CFB1 [] =&G T DES-EDE3-CFB8 [153] = DES-EDE3-OFB [154] = DES-OFB [155] = DESX-CBC [156] = gost89 [157] =& Gt gost89-cnt [158] = ID-AES128-CCM [159] = ID-AES128-GCM [] = id-aes128-wrap [161] = Id-aes19     2-CCM [162] = ID-AES192-GCM [163] = Id-aes192-wrap [164] = id-aes256-ccm [165] = ID-AES256-GCM    [166] = id-aes256-wrap [167] = Id-smime-alg-cms3deswrap [168] = IDEA-CBC [169] = IDEA-CFB    [IDEA-ECB] = [171] = IDEA-OFB [172] = RC2-40-CBC [173] + RC2-64-CBC [174] = RC2-CBC  [175] = RC2-CFB [176] = RC2-ECB [177] = RC2-OFB [178] = RC4 [179] + rc4-40 [[+]] = RC4-HMAC-MD5 [181] = SEED-CBC [182] = SEED-CFB [183] = SEED-ECB [184] = SEED-OFB)
// 使用openssl加密数据$string = openssl_encrypt('要加密的数据','des-cfb','秘钥des为8位',0,'IV des为8位');var_dump($string);

The main is the DES algorithm, then sends a request, returns the result only.
There should be similar algorithms on the Web, recommending one:
Http://www.cnblogs.com/wangchuang/archiv ...
(Baidu Search, found)

When interacting with other languages, the language is Base64 decrypted and then des decrypted to obtain the original data. Python,ios Yes, other languages not tested, i.e. Des_decrypt (Base64_decrypt ($pass _string)) It will be.

  • 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.