Home php教程 PHP源码 二次加密,数据校验

二次加密,数据校验

May 25, 2016 pm 05:06 PM

二次加密,数据校验

用于二次加密,数据校验,也许md5已经足够了,不过在用户密码字段里,还是会经常看到这样的md5串: e10adc3949ba59abbe56e057f20f883e,经常开测试账号的人你懂的

<?php
$txt = "123456";// 原文
echo "txt={$txt}\r\n";
$key = "keyword";// 密钥,最好用ord后127以内的字符,且不要有字符重复
$encrpt = md5($txt);// md5后的密文
echo "md5={$encrpt}\r\n";

$j = 0;
$lk = strlen($key);
$lt = strlen($encrpt);

for($i = 0;$i < $lt;$i++){
  $j %= $lk;
  $sum = ord($encrpt[$i]) + ord($key[$j]);// 逐位拼接密钥
  $encrpt[$i] = dechex($sum % 16);// 对16求余后生成新的16进制数,并替换对应位置字符
  $j++;
}
echo "encrpt={$encrpt}";
?>
Copy after login

               

 以上就是二次加密,数据校验的内容,更多相关内容请关注PHP中文网(www.php.cn)!

   

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to perform data verification in C++ code? How to perform data verification in C++ code? Nov 04, 2023 pm 01:37 PM

How to perform data verification on C++ code? Data verification is a very important part when writing C++ code. By verifying the data entered by the user, the robustness and security of the program can be enhanced. This article will introduce some common data verification methods and techniques to help readers effectively verify data in C++ code. Input data type check Before processing the data input by the user, first check whether the type of the input data meets the requirements. For example, if you need to receive integer input from the user, you need to ensure that the user input is

Using Python to implement data verification in XML Using Python to implement data verification in XML Aug 10, 2023 pm 01:37 PM

Using Python to implement data validation in XML Introduction: In real life, we often deal with a variety of data, among which XML (Extensible Markup Language) is a commonly used data format. XML has good readability and scalability, and is widely used in various fields, such as data exchange, configuration files, etc. When processing XML data, we often need to verify the data to ensure the integrity and correctness of the data. This article will introduce how to use Python to implement data verification in XML and give the corresponding

How to use Vue and Element-UI for data verification and form validation How to use Vue and Element-UI for data verification and form validation Jul 21, 2023 pm 06:58 PM

How to use Vue and Element-UI for data verification and form validation Introduction: Form validation is a very important part of the web application development process. It ensures that user-entered data conforms to the expected format and requirements, thereby improving application stability and data accuracy. Vue.js is a very popular JavaScript framework, and Element-UI is a set of UI component libraries based on Vue.js, which provides a wealth of form components and verification methods to facilitate developers.

How to solve data verification problems in PHP development How to solve data verification problems in PHP development Jul 01, 2023 pm 04:36 PM

How to solve the data verification problem in PHP development PHP is a scripting language widely used in Web development. It is easy to learn, flexible and powerful. During the development process, data verification is an important task. By verifying the data entered by the user, the legality and security of the data can be ensured, and program errors or malicious use can be avoided. This article will introduce several methods to solve data verification problems in PHP development. Using PHP's built-in verification functions PHP provides some built-in verification functions that can easily verify data. example

PHP and SOAP: How to handle checksum correction of data PHP and SOAP: How to handle checksum correction of data Jul 28, 2023 pm 01:53 PM

PHP and SOAP: How to handle data checksum correction Introduction: In the Internet era, data interaction and processing are becoming more and more important. In web applications, we usually use SOAP (Simple Object Access Protocol) for data interaction. In the process of data interaction, data verification and correction are particularly important. This article will introduce how to use PHP and SOAP to perform data verification and correction in data interaction, and give detailed code examples. 1. The Importance of Data Verification Data verification is to ensure the accuracy and completeness of data.

How to handle data validation and cleaning of form data in Java? How to handle data validation and cleaning of form data in Java? Aug 11, 2023 am 11:17 AM

How to handle data validation and cleaning of form data in Java? With the development of web applications, forms have become the main way for users to interact with servers. However, due to the uncertainty of user input data, we need to verify and clean the form data to ensure the validity and security of the data. This article will introduce how to handle data verification and cleaning of form data in Java, and give corresponding code examples. First, we need to use the regular expressions provided by Java (RegularExpres

How to implement data verification and verification of statistical charts through ECharts and php interfaces How to implement data verification and verification of statistical charts through ECharts and php interfaces Dec 18, 2023 pm 02:13 PM

How to implement data verification and verification of statistical charts through ECharts and PHP interfaces. As the demand for data visualization increases, ECharts has become a very popular data visualization tool. As a common back-end scripting language, PHP is also widely used in web development. This article will introduce how to implement data verification and verification of statistical charts through ECharts and PHP interfaces, and provide specific code examples. First, we need to understand ECharts. ECharts is an open source software developed by Baidu

UniApp design and development skills for implementing custom forms and data verification UniApp design and development skills for implementing custom forms and data verification Jul 06, 2023 pm 07:39 PM

UniApp's design and development skills for implementing custom forms and data verification With the rapid development of the mobile Internet, the development of mobile applications has become an important technical requirement. As a cross-platform development framework, UniApp provides developers with the convenience of quickly building multi-platform applications. In the development of mobile applications, form and data verification are a very important link. This article will introduce the design and development skills of how to implement custom forms and data verification in UniApp. 1. Custom form design in Uni

See all articles