数据加密的基本原理就是对原来的明文的文件或数据按某种算法进行处理,使其成为不可读的一定代码,通常称为“密文”,通过这样的途径来达到保护数据不被非法窃取和阅读目的。 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

Atom editor mac version download
The most popular open source editor

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

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),
