This turned into a very long response.
Sorry about that.
Well, I'm right and, looking at some parts with your eyes, I'm wrong.
I guess I should have been more precise with my answer.
It is very true that the make up of any given steel has properties which increase, or decrease its stain resistance (that's a given).
But, the temper of a blade does also play a part in this! You can take a blade that has a high temper, and the same with a low temper. The higher the temper, the tighter the grain structure, which does make it more stain resistant!
Now in forging a blade (not stock removal), such as one in 1095. You can forge the blade and tighten the grain, and it will be mroe stain resistant. You can take that same blade and not forge it (just stock removal), and it will not be as resistant to staining.
These are just facts.
This is all true when you compare steel 1095 with steel 1095. There I agree completely, and is also where you took me as being wrong in my original statement.
The higher temper will contain more martensitic phase than a lower temper (in your words: more martensite = "tighten the grain"), and as the martensitic phase has a better stain resistance than the ferritic phase (which will be the main part of the remainder of the steel), it will inevitably give you a corresponding better stain resistance.
As martensite is also harder than ferrite, that's also the reason why the higher temper gives you a harder steel. I guess that's why you mean that a harder steel (in your words: "Rockwell") gives a better stain resistance.
Both "tighten the grain" and "Rockwell" have the same reason though, the higher martensitic content in the steel.
I assume these are the facts you're referring to.
If I misunderstood you wanting to compare stainlessness (is that a word?) between 1095 and D2, then just ignore the following and accept my apology. If I didn't misunderstand you...
However, when comparing a 1095 steel to a D2 steel, it's not the same story. This is where I disagree and where my original comment is true!
In that comparison, the chemical content, mainly the chromium, plays the main role.
Now, theoretically, a minimum of 12% chromium is needed to be able to call a steel stainless. In practice, however, a slightly higher chromium content is needed to make it a stainless steel in the true sense (whatever that means).
D2 contains 11-13% chromium (and some other stuff too) and a fair bit of that chromium is "used" together with it's relatively high carbon content to form coarse chromium carbides, leaving less than 12% chromium for stain resistance. This is the very reason D2 is so often called semi-stainless. Since it's on the very edge with the chromium content (or even slightly lower), a corrosive media (such as for instance blood on a hunting knife) can eat it's way through that stain protection if you're unlucky.
Now, as the 1095 steel doesn't contain any chromium at all, it will ALWAYS be less stain resistant than D2. Disregarding which heat treatment it has received . That's also why you readily get a patina on a 1095 steel, but not on the D2 steel.
Sorry about the rant but:
Ive been making knives for over 25 years.
I've been working as a materials engineer for 16 years, and the materials engineer that taught me the trade has been in it for over 40 years.
/ Karl