The hashing algorithm used by bitcoin is SHA-256; it always produces an output of fixed length, that is, 256-bits, regardless of how long the input is.
When we say brute-force we mean that a computer is systemically looking for a hash collision by trying every possible combination until it encounters one. The SHA-256 algorithm is really hard to brute-force because the chances of encountering a hash collision are extremely high. It would take so long to find this hash collision that when found it is safe to assume that the string you have hashed is the same as the collision you have found as it is extremely unlikely you have found the same hash using a different string.