The sacrificial anode is certainly a possible and common approach, but I will propose another approach using organic polymers (not “soft” , not Nylon).
According to the Engineers Edge website:
There are three conditions that must exist for galvanic corrosion to
occur. First there must be two electrochemically dissimilar metals
present. Second, there must be an electrically conductive path between
the two metals. And third, there must be a conductive path for the
metal ions to move from the more anodic metal to the more cathodic
metal. If any one of these three conditions does not exist, galvanic
corrosion will not occur.
Note that if you are not convinced of my proposed organic polymer approach that the link above includes a table of anodic indices for several metals and alloys.
Organic based corrosion inhibitors can strongly chemisorb to and effectively passivate many metal surfaces, including stainless steel and, I assume, brass. You only need it on one of the two. This chemisorbed layer prevents the formation of a water/electrolyte layer at the metal's surfaces. Additionally, this layer inhibits the transfer of metal ions. So this mitigates the second two out of the three criteria given above for galvanic corrosion to occur.
Pollyurea-based elastomers are commercially available and should be an excellent candidate in your case. This would be simple to implement and you have a good choice of commercially available products (here and here just for example) of varying physical characteristics. These types of elasomers are used in situations that are probably far more physically rigorous than your hinge would experience: sealing metallic joints in the hulls of maritime cargo vessels for example.
According to this Wikipedia page:
Some polyureas reach strengths of 6000psi (40MPa) tensile and over
500% elongation making it a tough coating.
Also sited in the same Wikipedia reference is an interesting line of research being taken to even further pollyurea-based elastomers’ already desirable characteristics:
In 2014 a polyurea elastomer-based material was shown to be
self-healing, melding together after being cut in half, without the
addition of catalysts or other chemicals. The material also includes
inexpensive commercially available compounds. The elastomer molecules
were tweaked, making the bonds between them longer. The resulting
molecules are easier to pull apart from one another and better able to
rebond at room temperature with almost the same strength.
The rebonding can be repeated. Stretchy, self-healing paints and other
coatings recently took a step closer to common use, thanks to research
being conducted at the University of Illinois. Scientists there have
used "off-the-shelf" components to create a polymer that melds back
together after being cut in half, without the addition of catalysts or
Literature references are given in the previous link.
The options I’ve discussed or referenced above focus on the choice of metals used for each component of the hinge or as a sacrificial anode (see table in Engineers Edge link) and a polyurea-based coating. I propose the polymer coating approach for the arguments made above including ready availability, affordability, likely effectiveness and relative simplicity.