If you are doing your hiking in California, you are out of luck. First, many places you may wish to go hiking such as state and federal parks have a prohibition on carrying a gun. California also has additional prohibitions on aliens transporting firearms. So even should you be able to get a gun, you may not be able to carry it.
As stated, you can possess a firearm if you have both a state issued hunting license and an alien number or admission number from the Department of Homeland Security.
However, you cannot purchase a firearm from a FFL without also being a resident of that state for 90 days. California does not allow the face-to-face purchasing of handguns, so the only way to purchase a handgun is from a FFL. That locks you out.
There is a process for bringing your own gun (submit ATF Form 6 NIA (Application and Permit for Importation of Firearms, Ammunition and Implements of War by Nonimmigrant Aliens)). You must still deal with state laws, however.