protected static function writeSaltToFile(string $salt): void
    {
        static::validateSalt($salt);
        $result = @file_put_contents(static::$saltFile, $salt);

        if (($result === false) || ($result <> strlen($salt))) {
            throw new InvalidArgumentException("Failed to write salt to file [" . static::$saltFile . "]");
        }
    }