sunjincheng created FLINK-6926:
----------------------------------

             Summary: Add MD5/SHA1/SHA2 supported in SQL
                 Key: FLINK-6926
                 URL: https://issues.apache.org/jira/browse/FLINK-6926
             Project: Flink
          Issue Type: Sub-task
          Components: Table API & SQL
    Affects Versions: 1.4.0
            Reporter: sunjincheng


MD5(str)Calculates an MD5 128-bit checksum for the string. The value is 
returned as a string of 32 hexadecimal digits, or NULL if the argument was 
NULL. The return value can, for example, be used as a hash key. See the notes 
at the beginning of this section about storing hash values efficiently.

The return value is a nonbinary string in the connection character set.

* Example:
 MD5('testing') - 'ae2b1fca515949e5d54fb22b8ed95575'

* See more:
** [MySQL| 
https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_sha1]


SHA1(str), SHA(str)Calculates an SHA-1 160-bit checksum for the string, as 
described in RFC 3174 (Secure Hash Algorithm). The value is returned as a 
string of 40 hexadecimal digits, or NULL if the argument was NULL. One of the 
possible uses for this function is as a hash key. See the notes at the 
beginning of this section about storing hash values efficiently. You can also 
use SHA1() as a cryptographic function for storing passwords. SHA() is 
synonymous with SHA1().

The return value is a nonbinary string in the connection character set.

* Example:
  SHA1('abc') -> 'a9993e364706816aba3e25717850c26c9cd0d89d'



SHA2(str, hash_length)Calculates the SHA-2 family of hash functions (SHA-224, 
SHA-256, SHA-384, and SHA-512). The first argument is the cleartext string to 
be hashed. The second argument indicates the desired bit length of the result, 
which must have a value of 224, 256, 384, 512, or 0 (which is equivalent to 
256). If either argument is NULL or the hash length is not one of the permitted 
values, the return value is NULL. Otherwise, the function result is a hash 
value containing the desired number of bits. See the notes at the beginning of 
this section about storing hash values efficiently.

The return value is a nonbinary string in the connection character set.

* Example:
SHA2('abc', 224) -> '23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7'
* See more:
** [MySQL| 
https://dev.mysql.com/doc/refman/5.7/en/encryption-functions.html#function_sha2]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to