Sahih Muslim , Hadith 1382

Abu Huraira (Allah be pleased with him) reported Allah's Messenger (way peace be upon him) as saying: I have been commanded (to migrate) to a town (Medina) which would overpower other towns. They (the people) call it Yathrib; its correct name is (in fact) Medina. It eliminates (bad) people just as a furnace removes the alloy of iron.

وَحَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، عَنْ مَالِكِ بْنِ أَنَسٍ، - فِيمَا قُرِئَ عَلَيْهِ - عَنْ يَحْيَى بْنِ، سَعِيدٍ قَالَ سَمِعْتُ أَبَا الْحُبَابِ، سَعِيدَ بْنَ يَسَارٍ يَقُولُ سَمِعْتُ أَبَا هُرَيْرَةَ، يَقُولُ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ أُمِرْتُ بِقَرْيَةٍ تَأْكُلُ الْقُرَى يَقُولُونَ يَثْرِبَ وَهْىَ الْمَدِينَةُ تَنْفِي النَّاسَ كَمَا يَنْفِي الْكِيرُ خَبَثَ الْحَدِيدِ ‏" ‏ ‏.‏

sunnah.com

This hadith has been narrated by Yabya b. Sa'id with the same chain of transmitters (and the words are): " Just as a furance removes impurity," but no mention is made of iron.

وَحَدَّثَنَا عَمْرٌو النَّاقِدُ، وَابْنُ أَبِي عُمَرَ، قَالاَ حَدَّثَنَا سُفْيَانُ، ح وَحَدَّثَنَا ابْنُ الْمُثَنَّى، حَدَّثَنَا عَبْدُ الْوَهَّابِ، جَمِيعًا عَنْ يَحْيَى بْنِ سَعِيدٍ، بِهَذَا الإِسْنَادِ وَقَالاَ ‏ "‏ كَمَا يَنْفِي الْكِيرُ الْخَبَثَ " ‏ ‏.‏ لَمْ يَذْكُرَا الْحَدِيدَ.

sunnah.com