Actually it is called a "dutch key" or sometimes just a "round key". Some mold makers use this for locating "pins" as well.
Joe's formulas are correct. I just checked them because the simplification looked funny to me. I thought that maybe the great Dr Joe might have slipped up. But when I wrote it out it looked better, and I got the same answer. That's what we get for using single line formulas.
According to Shigley, (Mechanical Engineering Design, 1977ed) Joe's example pin is a little large for the shaft. He recommends the key diameter be 1/4 of the shaft diameter and that the key be the length of the hub. If you're REALLY interested he provides stress concentration factors for the shaft, both keyed and pinned, as well.
I find that in practice Shigley is usually a little on the conservative side for our application. But then we don't do millions of cycles either. I usually follow Shigley unless something looks totally out of line and I've never had anything break yet. Though we do have the occasional weight problem
