MySQL Symmetric Encryption: Difference between revisions

From Lolly's Wiki
Jump to navigationJump to search
(Die Seite wurde neu angelegt: „ <source lang=mysql> > select hex(aes_encrypt(rpad("abcqweqweqweqwe",31,"~"),"mykey")) as encrypted; +---------------------------------------------------------…“)
 
m (Text replacement - "<source" to "<syntaxhighlight")
Line 1: Line 1:


<source lang=mysql>
<syntaxhighlight lang=mysql>
> select hex(aes_encrypt(rpad("abcqweqweqweqwe",31,"~"),"mykey")) as encrypted;
> select hex(aes_encrypt(rpad("abcqweqweqweqwe",31,"~"),"mykey")) as encrypted;
+------------------------------------------------------------------+
+------------------------------------------------------------------+
Line 9: Line 9:
</source>
</source>


<source lang=mysql>
<syntaxhighlight lang=mysql>
> select trim(trailing "~" from aes_decrypt(unhex("E5FB394568B8F03D43CF083F5065C959AC6E22BDB7749E4D97F5ABC72B08D843"),"mykey")) as decrypted;
> select trim(trailing "~" from aes_decrypt(unhex("E5FB394568B8F03D43CF083F5065C959AC6E22BDB7749E4D97F5ABC72B08D843"),"mykey")) as decrypted;
+-----------------+
+-----------------+

Revision as of 17:02, 25 November 2021

<syntaxhighlight lang=mysql> > select hex(aes_encrypt(rpad("abcqweqweqweqwe",31,"~"),"mykey")) as encrypted; +------------------------------------------------------------------+ | encrypted | +------------------------------------------------------------------+ | E5FB394568B8F03D43CF083F5065C959AC6E22BDB7749E4D97F5ABC72B08D843 | +------------------------------------------------------------------+ </source>

<syntaxhighlight lang=mysql> > select trim(trailing "~" from aes_decrypt(unhex("E5FB394568B8F03D43CF083F5065C959AC6E22BDB7749E4D97F5ABC72B08D843"),"mykey")) as decrypted; +-----------------+ | decrypted | +-----------------+ | abcqweqweqweqwe | +-----------------+ </source>