Sheffield Crown Court heard how Joshua Burnham, 25, had been living at the Norfolk Park bail hostel for around five weeks when the incident took place in the early hours of May 19 this year.
Burnham's victim was one of his housemates with whom he had an agreement to exchange amounts of cannabis for roll-up cigarettes, said Alisha Kaye, prosecuting.
She described how in the run-up to the attack, the victim went to Burnham's room to get some cannabis from him and knocked on the door.
Ms Kaye said: "There's no response. The complainant can hear music coming from the defendant's room. The complainant knocks again, but receives no response."
CCTV shown to the court revealed how the victim was outside Burnham's door for around five minutes. It shows him initially knocking on the door, before attempting to force the door with his shoulder.
After the victim eventually managed to force Burnham's door open, Burnham then began repeatedly striking him to the head and body with a claw hammer, the court heard.
"The complainant puts his arms up over his head, trying to protect himself. The defendant hits him again to the back of the head while he's on the floor. The defendant appears to walk away, but is seen to come back and hit him again," said Ms Kaye.
The victim was left with lacerations to the side of his head, a fracture to his left forearm and a fracture to one of his metacarpals, the intermediate part of the skeletal hand located between the phalanges of the fingers and the carpal bones of the wrist.
The court was told that the continuing effects of the victim's injuries could not be ascertained because he had refused to co-operate with the police by providing a victim personal statement.
Burnham, now of no fixed abode, pleaded guilty to one count of grievous bodily harm with intent at an earlier hearing.
Defending, Rebecca Tanner, told the court that Burnham, who suffers from schizoaffective disorder, denied supplying his victim with cannabis prior to the incident.
"At the time the complainant began banging on his door he was asleep, and was drowsy. He tried calling for help but the support worker was downstairs. He tried using his mobile phone for assistance. It must have been a very frightening situation for him," said Ms Tanner.
She added: "He does have genuine remorse, he's had to watch the footage on a number of occasions."
Judge Michael Slater jailed Burnham for six years for the offence.
He told him: "You struck him nine or 10 times, the majority of which were to his head. You moved to one side and then returned to strike him a further time to the head."
"Miraculously, he didn't sustain serious injuries to his head. We know very little of the effect this has had on him," added Judge Slater.
* South Yorkshire Police have been asked to provide a custody image of Burnham