user1663023
user1663023

Reputation:

Encrypt function behavior difference on macOS and Linux?

It seems the ENCRYPT function works very differently on Linux from on macOS. I wonder why?

set @salt := SHA2(RAND(), 512);
select ENCRYPT('abc', CONCAT('\$6\$rounds=5000$', @salt));

Linux 5.4.174-2-pve / Mariadb 10.7

$6$rounds=5000$36fcf04d0f759de9$eZedOjHbDve6bomhxF95pzFUajCzFGgnNxh8JapGZlCb5NzzT2ze96hhO8s803zpPGMP4L48hhBm.6cHAv6Op/

macOS 12.4 / Mariadb 10.8

$6G/aJp5H5PCs

Upvotes: 1

Views: 56

Answers (1)

Georg Richter
Georg Richter

Reputation: 7476

MariaDB's ENCRYPT() function uses the crypt() function of the libcrypt library. The implementation of crypt() is different on Mac and Linux: While Linux uses SHA512, the Mac variant uses DES.

Upvotes: 2

Related Questions