php - mysql check data in sha512 encryption -
i need check data in sha512 encryption mysql query , php
i can md5 :
select * text md5(id) = '$id'
but , how in sha512?
regards
mysql 5.5+
select * text sha2(id, 512) = '$id'
more details :
calculates sha-2 family of hash functions (sha-224, sha-256, sha-384, , sha-512). first argument cleartext string hashed. second argument indicates desired bit length of result, must have value of 224, 256, 384, 512, or 0 (which equivalent 256). if either argument null or hash length not 1 of permitted values, return value null. otherwise, function result hash value containing desired number of bits. see notes @ beginning of section storing hash values efficiently.
the return value nonbinary string in connection character set.
mysql> select sha2('abc', 224); -> '23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7'
this function works if mysql has been configured ssl support. see section 6.3.9, “using ssl secure connections”.
sha2() can considered cryptographically more secure md5() or sha1().
Comments
Post a Comment