Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Ruth Bader Ginsburg has never shied away from speaking out about gender inequality — even back when she was a college student and an instructor acted inappropriately with her, she revealed on Sunday.

The 84-year-old Supreme Court justice was at a panel in Park City, Utah, attending the Sundance Film Festival for the premiere of "RBG," a documentary about her life, when she was asked about the #MeToo movement.

"It's about time. For so long women were silent, thinking there was nothing you could do about it, but now the law is on the side of women, or men, who encounter harassment, and that's a good thing," Ginsburg told NPR's Nina Totenberg.

She then recalled a #MeToo moment of her own during the 1950s with a Cornell chemistry instructor from whom she had sought help before a test.

Supreme Court Justice Ruth Bader Ginsburg speaks at the Sundance Film Festival on Sunday. Robin Marchant / Getty Images

The instructor gave her what he said was a practice exam, Ginsburg said. But when she took the real test the following day, she realized it was identical to the one he had given her.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"And I knew exactly what he wanted in return," Ginsburg said.

But Ginsburg, who would later go on to become a nationally recognized women's rights lawyer and then the second woman ever appointed to the nation's highest court, refused to be intimidated by her instructor.

She said she "went to his office and said: 'How dare you? How dare you do this?' And that was the end of that."

Totenberg, a legal affairs correspondent for NPR and a longtime friend of Ginsburg's, commented that Ginsburg "must have done quite well" on the exam.

"I deliberately made two mistakes," Ginsburg responded with a smile.

Ginsburg said that sexual harassment happened frequently back then — "every woman of my vintage knows what sexual harassment is, although we didn't have a name for it" — and said she didn't worry there would be a backlash to the recent wave of allegations of sexual misconduct.

"So far it's been great," she said. "When I see women appearing every place in numbers, I'm less worried about a backlash than I might have been 20 years ago."

The justice also told stories of the blatant sexism she encountered as a young professional, including as a law professor at Rutgers Law School, when she was forced to take a salary cut. When she asked how much of a cut one of her male peers would be taking, the dean told her: "Ruth, he has a wife and two children to support. You have a husband with a good paying job in New York." Together with other women working at Rutgers, she filed an Equal Pay Act complaint, and the university eventually settled.

Ginsburg has been on the Supreme Court for 25 years and has acquired a cult following for her pioneering work against gender discrimination and her dry sense of humor. She has been dubbed "the Notorious RBG" by her followers, and has been parodied on "Saturday Night Live."

"I liked the actress who portrayed me," she said of Kate McKinnon. "And I would like to say 'Gins-Burn' sometimes to my colleagues," she said, referencing McKinnon's catchphrase.

Ginsburg assured fans on Sunday that she had no plans to retire any time soon.

"As long as I can do the job full steam, I will be here," she said.