Internet Information age, as long as the travel registration, you have to provide users with the relevant personal identification number, cell phone number, and other information, how to keep the user's information securely stored. Next, let me witness the powerful PostgreSQL. Install Pgcrypto encryption Module
#create extension pgcrypto;
CREATE EXTENSION
A number of commonly used decryption functions are provided here, which can be used directly in the system, such as: encrypt
# Select Encrypt (' 18600001111 ', ' test123456 ', ' AES ');
Encrypt
------------------------------------
\x5893e4d2bc48c6538bf7e0db529fc54e
(1 row)
Using the AES algorithm to encrypt a phone number, the key is test123456. Decrypt
# Select Convert_from (Decrypt (' \x5893e4d2bc48c6538bf7e0db529fc54e ', ' test123456 ', ' AES '), ' sql_ascii ');
Convert_from
--------------
18600001111
(1 row)
A encrypt encrypted binary stream, decrypted, and the key is also test123456.
Convert_from is a function that converts a binary to a specified encoding.
As long as the save number key is resolved,