MySQL Symmetric Encryption

From Lolly's Wiki
Revision as of 15:35, 11 January 2016 by Lollypop (talk | contribs) (Die Seite wurde neu angelegt: „ <source lang=mysql> > select hex(aes_encrypt(rpad("abcqweqweqweqwe",31,"~"),"mykey")) as encrypted; +---------------------------------------------------------…“)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
> select hex(aes_encrypt(rpad("abcqweqweqweqwe",31,"~"),"mykey")) as encrypted;
+------------------------------------------------------------------+
| encrypted                                                        |
+------------------------------------------------------------------+
| E5FB394568B8F03D43CF083F5065C959AC6E22BDB7749E4D97F5ABC72B08D843 |
+------------------------------------------------------------------+
> select trim(trailing "~" from aes_decrypt(unhex("E5FB394568B8F03D43CF083F5065C959AC6E22BDB7749E4D97F5ABC72B08D843"),"mykey")) as decrypted;
+-----------------+
| decrypted       |
+-----------------+
| abcqweqweqweqwe |
+-----------------+