Language:
كتاب الحدود
86  
Limits and Punishments set by Allah (Hudood)
(27)
Chapter: If a person confesses but does not specify the sin can the ruler screen it for him?
(27)
باب إِذَا أَقَرَّ بِالْحَدِّ وَلَمْ يُبَيِّنْ، هَلْ لِلإِمَامِ أَنْ يَسْتُرَ عَلَيْهِ
Sahih al-Bukhari 6823

Narrated Anas bin Malik:

While I was with the Prophet (ﷺ) a man came and said, "O Allah's Messenger (ﷺ)! I have committed a legally punishable sin; please inflict the legal punishment on me'.' The Prophet (ﷺ) did not ask him what he had done. Then the time for the prayer became due and the man offered prayer along with the Prophet (ﷺ) , and when the Prophet (ﷺ) had finished his prayer, the man again got up and said, "O Allah's Messenger (ﷺ)! I have committed a legally punishable sin; please inflict the punishment on me according to Allah's Laws." The Prophet (ﷺ) said, "Haven't you prayed with us?' He said, "Yes." The Prophet (ﷺ) said, "Allah has forgiven your sin." or said, "....your legally punishable sin."

حَدَّثَنِي عَبْدُ الْقُدُّوسِ بْنُ مُحَمَّدٍ، حَدَّثَنِي عَمْرُو بْنُ عَاصِمٍ الْكِلاَبِيُّ، حَدَّثَنَا هَمَّامُ بْنُ يَحْيَى، حَدَّثَنَا إِسْحَاقُ بْنُ عَبْدِ اللَّهِ بْنِ أَبِي طَلْحَةَ، عَنْ أَنَسِ بْنِ مَالِكٍ ـ رضى الله عنه ـ قَالَ كُنْتُ عِنْدَ النَّبِيِّ صلى الله عليه وسلم فَجَاءَهُ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ إِنِّي أَصَبْتُ حَدًّا فَأَقِمْهُ عَلَىَّ‏.‏ قَالَ وَلَمْ يَسْأَلْهُ عَنْهُ‏.‏ قَالَ وَحَضَرَتِ الصَّلاَةُ فَصَلَّى مَعَ النَّبِيِّ صلى الله عليه وسلم فَلَمَّا قَضَى النَّبِيُّ صلى الله عليه وسلم الصَّلاَةَ قَامَ إِلَيْهِ الرَّجُلُ فَقَالَ يَا رَسُولَ اللَّهِ إِنِّي أَصَبْتُ حَدًّا، فَأَقِمْ فِيَّ كِتَابَ اللَّهِ‏.‏ قَالَ ‏"‏ أَلَيْسَ قَدْ صَلَّيْتَ مَعَنَا ‏"‏‏.‏ قَالَ نَعَمْ‏.‏ قَالَ ‏"‏ فَإِنَّ اللَّهَ قَدْ غَفَرَ لَكَ ذَنْبَكَ ‏"‏‏.‏ أَوْ قَالَ ‏"‏ حَدَّكَ ‏"‏‏.‏
Reference : Sahih al-Bukhari 6823
In-book reference : Book 86, Hadith 51
USC-MSA web (English) reference : Vol. 8, Book 82, Hadith 812
  (deprecated numbering scheme)