Removed newline at the end and fixed isLegacyHash check