当前位置:网站首页>How to encrypt the data in MySQL database? Mysql8.0 comes with new features
How to encrypt the data in MySQL database? Mysql8.0 comes with new features
2022-07-27 19:58:00 【Operation and maintenance home】

===============================================================================================================================================================================
Encryption function is mainly used to encrypt data and process interface , To ensure that some important data are not obtained by others .
Encryption function MD5(str)
md5(str) String calculate one md5 128 Bit checksum .
The value is expressed in 32 Returns... As a binary string of hexadecimal digits , If the parameter is null, Then the returned value is null;
mysql> select md5('yunweijia'), length(md5('yunweijia'));
+----------------------------------+--------------------------+
| md5('yunweijia') | length(md5('yunweijia')) |
+----------------------------------+--------------------------+
| e1c2c47c0b1d8ca6076030bf8e8ea42a | 32 |
+----------------------------------+--------------------------+
1 row in set (0.00 sec)
mysql>
You can see that it is indeed a 32 String of hexadecimal digits with bit length .
Encryption function SHA(str)
SHA(str) From the original plaintext password str Calculate and return the encrypted password string , When the parameter is null When , The returned value is null.
SHA Encryption algorithm relative to MD5 encryption algorithm , It will be safer .
mysql> select sha('yunweijia');
+------------------------------------------+
| sha('yunweijia') |
+------------------------------------------+
| 683501978a90d76d420b893cd7e00c8efde8e8f3 |
+------------------------------------------+
1 row in set (0.00 sec)
mysql>
Encryption function SHA2(str, hash_length)
SHA2(str, hash_length): Use hash_length As length , Encrypted string str;
hash_length The value of support is :224、256、384、512 and 0, Why is there 0 Well , If it is 0 Words , It's the equivalent of 256 了 .
mysql> select sha2('yunweijia', 256) as A, sha2('yunweijia', 0) as B\G;
*************************** 1. row ***************************
A: 1c60cca8fb0ef62bbf751245f72bbb7c308d59d773214133dc6051cd4acd0b64
B: 1c60cca8fb0ef62bbf751245f72bbb7c308d59d773214133dc6051cd4acd0b64
1 row in set (0.00 sec)
ERROR:
No query specified
mysql>
From the above running results, we can see ha , When our hash_length The value of is 256 and 0 when , Their results are consistent .
thus , In this paper, the end .
For more information, go to VX official account “ Operation and maintenance home ” , Get the latest article .
------ “ Operation and maintenance home ” ------
------ “ Operation and maintenance home ” ------
------ “ Operation and maintenance home ” ------
linux Interrupt exception ,linuxuml modeling ,linux Compile multiple source files ,linux How to update the time ,linux Paging video tutorial in ,
linux How to decompress gzip,linux Unzip a directory , How to close linux gateway ,linux Document structure diagram ,linux Improve the permission to execute ,
linux What mark is used in the document , Network security linux strengthening ,linux Check email in ,linux Change the background color ,linux Build a website under the environment .
边栏推荐
猜你喜欢

JS event listening mouse keyboard form page onclick onkeydown onchange

UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xff in position 0: invalid start byte

VirtualBox: set shared folder

注入攻击

使用VS编译NCNN

Togglebutton (button switch)

An unknown fastcgi error occurred in IIS: 0x80070005

Sharepreference (storage)

成年人只有一份主业是要付出代价的,被人事劝退后,我哭了一整晚

SharePreference(存储)
随机推荐
【C#】正序、逆序、最大值、最小值和平均值
Built in module 10.18
C191:密码编译
Introduction to socke programming
访问控制
四大组件之ContentProvider
22年PMP考试【全真敏捷试题】
Broadcastreceiver (broadcast)
Radiogroup (radio box)
Transaction log full problem handling in sqlserver 2008
Remember an unprepared internship interview
11.2DHCP
Hyperledger caliper is built on fabric for performance test
SystemService(系统服务)
Can go to QQ but can't open the web page
真实案例,大学生接单被骗,希望大家不要被骗了【惨痛教训】
总线Bus是什么意思
dp(动态规划)
强化学习介绍
PMP每日一练 | 考试不迷路-7.27(包含敏捷+多选)