Maybe I'm going to ask a stupid question, but if the hash function hasn't been changed, why not directly use the MySQL PASSWORD() function?
$sql = "INSERT INTO account (login, password, social_id, email) VALUES (?, PASSWORD(?), ?, ?)";
$stmt = $pdo1->prepare($sql);
$stmt->execute([$login, $password, $social_id, $email]);
PASSWORD('123456789') give you *CC67043C7BCFF5EEA5566BD9B1F3C74FD9A5CF5D.
Edit : or this if you're on MySQL 8 (ty Gurgarath)
CONCAT('*', UPPER(SHA1(UNHEX(SHA1(?)))));
or
-- not tested
CREATE FUNCTION PASSWORD(input VARCHAR(255)) RETURNS CHAR(41)
BEGIN
DECLARE output CHAR(41);
SET output = CONCAT('*', UPPER(SHA1(UNHEX(SHA1(input)))));
RETURN output;
END;