I walked many, many trails in Alaska with a Raging bull in 454 casull. 12 ga with Brenneke slugs is an old stand-by, but a 44 magnum+ will serve you well. Shotgun gets really heavy after a few miles. Make sure to use ammo loaded with solid brass bullets, or the hardest lead JFP. You want penetration, and bear bones are tough. Headshots with a pistol are useless. Bear skull is very thick and sloped, so bullets will just ricochet. Aim for center mass.
PS raging bull was heavy, but still lighter than 12 ga, and with across the chest or under arm holster very easy to carry, plus climbing thru underbrush is a whole lot easier without a shotgun barrel snagging on things.
Make sure you are not hiking alone. Bring a slow overweight hiking buddy with you. Ex wife works good.
Every time I go into bear country, I take a the S&W 500. It is just the right tool for the job. In Alaska, most of the guides take 12 gauge pumps with pistol grips with them. They run slugs of course.
I have been out with wild bears several time, within 50 feet on many occasions. The trick is not to piss them off, and don't approach them. They are curious animals, and will be interested in you if you are around. They become very dangerous when they are startled or have cubs. As long as you don't keep your food in your camp, you should not have problems. Always make a separate cooking camp when in bear country and then hang your food and anything else that smells (toothpaste, lotion, etc.) in a bear bag at night. Just be sure to make noise when you hike, not yelling and screaming, but talk or sing, I used to play a small radio on my pack. Unless the bear is in a really bad way, or defending its young, it should leave you alone. One more thing, NEVER Run. If you come on a bear. Just keep facing it and back away. Talk to it, tell it you are backing away now. Bears will also bluff charge on occasion (this is were an extra pair of shorts could come in handy). Keep calm, raise your hands and yell as well jumping up and down to make yourself look bigger.
There has never been a bear attack on a group of 3 or more people. So it is always a good idea to stay in fairly close group when in bear country. You basically look like one big thing that bear cant tell if it can eat you or you will eat it.
While it is a great idea to take protection. I hope you wont let the idea of a bear attack take away from enjoying the trip. The odds of something happening are probably lower than winning the lottery.