It depends on the format. Prefixed schemes such as bcrypt, Argon2, yescrypt, sha512crypt and PBKDF2 identify themselves and get close to certainty. Bare hexadecimal digests are ambiguous by nature: several algorithms produce the same 32, 40 or 64-character output, so the correct answer is a ranked list, not a single name.