Warning: Both hashers exist only for legacy reasons! Don't use them for new projects!
See the official php password hashing FAQ.
You should only use them together with the FallbackPasswordHasher so you can migrate you old insecure hashes to a new hash algorithm.
$hasher = new Md5PasswordHasher();
$hasher->setSalt('some-salt');
$hash = $hasher->hash('password');
$check = $hasher->check('password', 'hashedpasswordvalue');