Almost certainly by smell.
I'm a trans woman, and when I started hormones, one of the first things my partner noticed was that my odor went from overpowering and musty to just kind of "stale". I can get away with wearing shirts 2 or 3 times between washings, or go without bathing for a day or two. That was definitely not possible before hormones (at least without offending the people around me).
So I'd say yeah, if even humans can tell the difference in most cases then a dog definitely would.