/*
Navicat Premium Data Transfer
Source Server : TW
Source Server Type : MySQL
Source Server Version : 50739
Source Host : localhost:3306
Source Schema : mybatis_plus
Target Server Type : MySQL
Target Server Version : 50739
File Encoding : 65001
Date: 21/10/2022 17:11:07
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for testmd5
-- ----------------------------
DROP TABLE IF EXISTS `testmd5`;
CREATE TABLE `testmd5` (
`id` int(4) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`pwd` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of testmd5
-- ----------------------------
INSERT INTO `testmd5` VALUES (1, 'zhansan', 'e10adc3949ba59abbe56e057f20f883e');
INSERT INTO `testmd5` VALUES (2, 'lisi', '123457');
INSERT INTO `testmd5` VALUES (3, 'wangwu ', '123458');
INSERT INTO `testmd5` VALUES (4, 'xiaoming', '51f6f8fe03a390d3de50ad49913d4b66');
SET FOREIGN_KEY_CHECKS = 1;
-- MD5加密
USE testmd5;
-- 加密
UPDATE testmd5 set pwd=MD5(pwd) WHERE id=1;
UPDATE testmd5 set pwd=MD5(pwd);
-- 插入时加密:重要!
INSERT INTO testmd5 VALUES(4,'xiaoming',MD5('123459'));
-- 如何校验:将用户传递过来的密码,进行MD5加密,然后比对加密后的值
SELECT * FROM testmd5 WHERE `name`='zhansan' AND pwd=MD5(123457);
MD5 信息摘要演算法(Message-Digest Algorithm),一种被广泛使用的密码杂凑函数,可以产生出一个128位元(16位元组)的散列值(hash value),用于确保信息传输完整一致。