数据加密的基本原理就是对原来的明文的文件或数据按某种算法进行处理,使其成为不可读的一定代码,通常称为“密文”,通过这样的途径来达到保护数据不被非法窃取和阅读目的。 PHP加密的函数主要有:crypt()、md5()和sha1()函数,还有加密的拓展库Mcrypt和Mas
数据加密的基本原理就是对原来的明文的文件或数据按某种算法进行处理,使其成为不可读的一定代码,通常称为“密文”,通过这样的途径来达到保护数据不被非法窃取和阅读目的。
PHP加密的函数主要有:crypt()、md5()和sha1()函数,还有加密的拓展库Mcrypt和Mash。这里主要介绍:crypt()、md5()和sha1()
PHP相关代码:
<?php //crypt()函数加密 $content="12345678"; echo '加密前$content的值为:'.$content."<br/>"; $crypt=crypt($content); echo '加密后$crypt的值为:'.$crypt."<br>"; echo"<br>"; //md5()函数加密 $md5="12345678"; echo '加密前$md5的值为:'.$md5."<br>"; $md5s=md5($md5); echo '加密后$md5s的值为:'.$md5s."<br>"; echo"<br>"; //sha1()函数加密 $sha1="12345678"; echo '加密前$sha1的值为:'.$sha1."<br>"; $sha1s=sha1($sha1); echo '加密后$sha1s的值为:'.$sha1s."<br>"; ?>
结果展示:

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

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

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
