Second the Pelican suggestion.
BS, before you cheap out and use DIY foam, educate yourself about the stuff.
I make this suggestion because my hard cases (Pelican 1500 for my Nikon kit, Tundra 821 made by Underwater Kinetics, for my Beaulieus) came with very durable pluckable closed cell foam. Very durable as in "I've had the cases for 24 years and the foam hasn't started to break down yet." Closed cell foam is desirable because it doesn't absorb anything. I use open cell foam from the local upholstery/fabric store in aquarium filters; spare foam pads left on the shelf slowly harden and crumble.
I haven't checked for years, but B&H used to sell replacement foam for Pelican cases. So if you decide to use a case you bought without foam, that may be a good source for you.