Ive put some down in a pen with my G27 as well. Much easier to get that head shot when they aren't charging after you and you need them to stop right immediately.
A better place to start is " what do you have for a pistol and what is your shooting experience?"
If you have experience with revolvers, look at them, same with auto pistols. For a caliber I would say a minimum of .40 in autos and ..357 in a revolver. There is no wrong answer, just more of a preference by the shooter. I have brought a 1911 and by hunting partner brings a 9mm FN p9.
I use an XD tactical in .45 its all about personal preferance and what you are experienced with. Also what you are comfortable walking thru the swamp with. Any caliber 9mm, .357,.40,.45 would work well.
A Glock 35 with 16 rounds of 180gr. Gold Dot ammunition and a spare magazine loaded with 22 rounds of same. If time allows insert the 22 round magazine before shooting because you know you will miss a few when THEY start running in your direction.
"For protection" implies you arent shooting them in a cage or trap. I like the big bore revolvers with hard cast. The big snubbies carry well and heavy for caliber lead with a wide, flat nose is good medicine.
" For Protection" are you hunting them or are they hunting you?
My Grandfather hunted hogs by baiting with corn and ambushing them from a blind with a 22 LR rifle. Would place a bullet through the ear hole into the brain..
Running them with dogs and shooting from the ground I would say a 41 magnum minimum.
Gary
You probably could kill them with a nail gun in a pen. I wouldn't trust a 22, 380, etc. to down a free ranging hog but a 22 magnum rifle will do it on head/neck shot. As far as charging pig it would be at least a 45 on up to stop or turn the beast.
Charging hog? How about a red cape and some banderillas ( those things they stick the bulls with)? ...and of course, a video camera. You could get your own show on the History Channel "Bayou Pig fighters"