The curse of Ham; picture taken from the front cover of David Goldenbergs book with the same title
Taken from: www.yale.edu
D.M. Goldenberg : the curse of Ham, Race and slavery ........
He recalls a story of Ka'b al-Ahbar (a rabbi turned Muslim who accompanied Umar during the conquest of Jerusalem in 638)
He writes in his chapter on Noah: It is said that one day Noah came to his son and said, "My son, I have not slept since I boarded the ark, and now I desire to sleep my fill." So saying, he put his head on Shem's lap and went to sleep. Suddenly a gust of wind uncovered Noah's genitals; Ham laughed, but Shem jumped up and covered him. When Noah awoke he said, "What was that laughter?" Shem told him what had happened, and Noah grew angry with Ham. "Do you laugh at your father's genitals?" he said. "May God change your complexion and may your face turn black!" And that very instant his face did turn black. Turning to Shem, he said, "You covered your father: may God shield you from harm in this world and have mercy upon you in the next! May He make prophets and nobles of your progeny! May He make bondswomen and slaves of Ham's progeny until the Day of Resurrection! May He make tyrants, kings and emperors of Japheth's progeny!" And God knows best.
When Noah died, Ham lay with his wife, and God opened his gaul-vesicle and that of his wife also so that they mingled and she conceived a black boy and girl. Ham despised them and said to his wife, They are not mine. They are yours, said the wife, for the curse of your father is upon us. After that he did not approach her until the children had grown, when he lay again with her, and she bore two more black children, male and female. Ham knew that they were his, therefore he left his wife and fled. When the first two children grew up, they went out in search of their father; but when they reached a village by the edge of the sea, they stayed there. God sent desire to the boy so that he lay with his sister, and she conceived. They remained in that village with no food except the fish they caught and ate. Then she gave birth to her brother's children, a black boy and girl.
Ham, meanwhile returned seeking the two children and , not finding them, died soon afterwards of anxiety over them. His wife also died, and the other two children set out in search of their brother and sister until they came to a village by the shore, where they stayed. They then joined the other two along with their own two children. They remained there and each brother lay with his sister, begetting black (aswadayn) male and female children until they multiplied and spread along the shore. Among them are the Nubians (n-ba), the Negroes (zanj), the barbers (b-rb-r), the sindhis (sind), the Indians (hind) and all the blacks (s-d-n) : they are the children of Ham.
Note: if we could be sure that Ka'b al-Ahbar is his original story also used the word Zanj, then we would have a very early use of the word here