Hillel, the Elder, was a Rabbi who lived in Jerusalem. He died when Jesus was young. Jesus may have been familiar with Hillel’s teachings.
Shammai was a rival Rabbi to Hillel.
* * *
Once there was a gentile who came before Shammai, and said to him: “Convert me on the condition that you teach me the whole Torah while I stand on one foot. Shammai pushed him aside with the measuring stick he was holding.
The same fellow came before Hillel, and Hillel converted him, saying: That which is despicable to you, do not do to your fellow, this is the whole Torah, and the rest is commentary, go and learn it.”
– Babylonian Talmud, Shabbat 31a
* * *
Therefore all things whatsoever ye would that men should do to you, do ye even so to them: for this is the law and the prophets. (Matthew 7:12 & 3 Nephi 14:12)