The data-encryption function

Since Hive v1.3.o, aes_encrypt(input string/binary, key string/binary) and aes_decrypt(input binary, key string/binary) UDF have been provided to support data encryption and decryption using the AES (Advanced Encryption Standard: http://en.wikipedia.org/wiki/Advanced_Encryption_Standard) algorithm, which is a symmetric 128-bit, block-data encryption technique developed by Belgian cryptographers Joan Daemen and Vincent Rijmen.

The following is an example of using these functions:

-- 1st para. is value to encryped/decryped
-- 2nd para. is 128 bit (16 Byte) keys
> SELECT
> name,
> aes_encrypt(name,'1234567890123456') as encrypted,
> aes_decrypt(
> aes_encrypt(name,'1234567890123456'),
> '1234567890123456') as decrypted
> FROM employee;
+---------+-------------------------+-----------+
| name | encrypted | decrypted |
+---------+-------------------------+-----------+
| Michael | ��.b��#����-��I | Micheal |
| Will | "�""��r {cgR�%��� | Will |

| Shelley | ��W@ߡ�Dm�[-�?� | Shelley |
| Lucy | ��/i���x���L�q~ | Lucy |

+---------+------------------------+------------+
4 rows selected (0.24 seconds)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.93.141