


Summary of usage of PHP encryption functions md5, crypt, base64_encode, etc.
php will use the encryption of the characters variable when registering, logging in or passing parameters in the URL. Let’s briefly introduce it: PHP’s own encryption function
Irreversible encryption functions are: md5(), crypt()
md5() is used to calculate MD5 hash. The syntax is: string md5(string str);
crypt() Encrypt string using UNIX’s standard encryption DES module. This is a one-way encryption function and cannot be decrypted. To compare strings, place the first two characters of the encrypted string in the salt parameter, and then compare the encrypted strings. The syntax is: string crypt(string str, string [salt]);
The reversible encryption is: base64_encode(), urlencode() and the corresponding decryption function: base64_decode(), urldecode()
base64_encode() MIME BASE64 encodes the string. This encoding method allows Chinese text or pictures to be transmitted smoothly over the Internet. The syntax is string base64_encode(string data); Its decryption function is: string base64_decode(string encoded_data); It will return to its original state
urlencode() URL-encodes the string. For example, spaces will become plus signs. The syntax is: string urlencode(string str);
Its decryption function is: string urldecode(string str); It will return to the original state
Look at the code:
Code As follows:
<?php define("str","墨剑"); echo 'md5 加密后的结果为:'.md5(str).'<br>';//md5 加密 echo 'crypt加密后的结果为:'.crypt(str,str).'<br>';// crypt加密 $base64encode=base64_encode(str);// base64_encode() 加密 echo 'base64_encode加密后的结果为:'.$base64encode.'<br>'; echo 'base64_decode解密后的结果为:'.base64_decode($base64encode).'<br>'; //base64_decode()解密 $urlencode=urlencode(str); //urlencode() 加密 echo 'urlencode加密后的结果为:'.$urlencode.'<br>'; echo 'urldecode解密后的结果为:'.urldecode($urlencode).'<br>';//urldecode() 解密 ?>
The output result is:
md5 The encrypted result is: ea796af15c74e90faeba49576fa7984b
crypt The encrypted result is: ink ylCzgTtYXPs
base64_encode The encrypted result is: xKu9ow==
base64_decode The result after decryption is: Mo Jian
The result after urlencode encryption is: %C4%AB%BD%A3
The result after urldecode decryption is: Mo Jian
The above is the detailed content of Summary of usage of PHP encryption functions md5, crypt, base64_encode, etc.. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Whether you have an old computer or need your PC to run many tasks simultaneously, you may want to disable the Windows Modules Installer worker. The reason is that the Windows Modules Installer worker places a high load on your disk, CPU, and memory. You may use the best software to fix high CPU usage, but some reports show that it can even take up 100% CPU usage. While it can help you maintain a more secure and reliable system, it comes at a cost. Therefore, you can decide to keep it or disable it to avoid performance issues. In this article, we will explore in detail what is Windows Modules Installer Worker and how to enable or

1. Base64 encode the file file and print it to the standard output [root@pps~]#base64filec25haWx3YXJyaW9yCg== You can also do this: [root@pps~]#catfile|base64c25haWx3YXJyaW9yCg== 2. Read the file content from the standard input, base64 encode and print to standard output [root@pps~]#base64snailwarriorc25haWx3YXJyaW9yCg==3. Encode the string "snailwarrior" and print to standard output [root@p

The top ten cryptocurrency trading platforms include: 1. OKX, 2. Binance, 3. Gate.io, 4. Kraken, 5. Huobi, 6. Coinbase, 7. KuCoin, 8. Crypto.com, 9. Bitfinex, 10. Gemini. Security, liquidity, handling fees, currency selection, user interface and customer support should be considered when choosing a platform.

Introduction What is Base64 encoding? Before answering this question, we need to understand the classification of files in computers. For computers, files can be divided into two categories, one is text files and the other is binary files. For binary files, their contents are represented in binary, which is not immediately understandable to humans. If you try to open a binary file with a text editor, you may see gibberish. This is because the encoding method of binary files is different from the encoding method of text files, so when the text editor tries to translate the binary files into text content, garbled characters will appear. For text files, there are many encoding methods, such as the earliest ASCII encoding and the currently commonly used UTF-8 and UTF

The Base64 algorithm is an encoding method that converts binary data into ASCII characters so that the data cannot be modified or damaged during transmission, and the true content of the data can also be hidden. In PHP, you can use built-in functions or manually write code to implement Base64 encoding and decoding.

In the ever-changing cryptocurrency space, a reliable source of information is crucial. To help investors and traders understand industry trends, this article lists the top ten must-see cryptocurrency websites. These sites provide in-depth market analysis, the latest industry news, technology updates and data-based insights to provide cryptocurrency enthusiasts with comprehensive resources to assist them in making informed investment decisions.

In an era of booming digital currencies, choosing a useful and reliable trading software is crucial. This article recommends the top 10 most trusted digital currency trading software in 2025, including Binance, Coinbase, FTX, Kraken, Huobi Global, KuCoin, Crypto.com, Phemex, Gemini and Gate.io. These platforms are evaluated based on factors such as user base, cryptocurrency selection, functionality, security, compliance and transaction fees, giving you the best choice to meet different needs.

1. Encrypt the command echo "ls-l" | 2. Decrypt the command and execute echobHMgLWwK | base64-d | At this time, you can only see the echo of the command, but not the command itself. What versions of Linux are there? Linux versions include: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and other versions. Among them, Deepin is one of the best-developed Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu; Manjaro is a Linux distribution based on Arch; LinuxMint's default Cinnamon desktop is similar to Win
