There are other questions about this but honestly I think the answers in them are a little oblique when it comes to actually doing it.
There's a classical formula you can find in many sources. It models the wheel in a very simple abstract way. The hub flanges are circles defined by the centers of the spoke holes and the rim is a circle defined by the end points of all the spokes when they have optimal engagement with the nipples (this is also the commonly understood definition of Effective Rim Diameter, or ERD). Here's how it appears in Brandt's The Bicycle Wheel:
You don't have to touch any real math to calculate spokes, however, because there are many different spoke length calculators out there that are based on this formula where you just plug in your hub and rim dimensions.
One of the sticky points of spoke length calculation is that the classic formula only takes into account the raw geometry, i.e. it's just describing a bunch of circles and triangles, but in real life, the rim compresses a bit when tension is applied, and the spokes elongate. How much depends on the particulars of the rim, namely its cross sectional area, and the gauge of the spokes, respectively. There are some sources out there that give specific numbers to show how to compensate fairly precisely for these effects, but in practical terms you just round down a bit, and how much depends on having a feel for what you're working with. Rounding up from the number the formula spits out is dangerous when calculating spokes because you risk running out of spoke thread, which can lead to situations where you have to struggle and maybe fail to get the final tension you would have otherwise chosen.
Many spoke length calculators invisibly do this rounding for you, but I like to use ones that don't, so that I don't have to wonder how much they're rounding, which direction, whether the amount was chosen based on the spoke gauge I'm actually using and what the tension will be, etc. The free spreadsheet-based calculator Spocalc is what I usually use. It's an .xls but opens fine in free spreadsheet software in my experience. It uses the terms "width from center to left flange" and "width from center to right flange" for the measurement your hub's page is calling "flange width." The page doesn't specify a spoke hole diameter, which is fine because you can just use 2.6mm as a generic one for most hubs. Here's how it looks with these hubs and rims plugged in:
Conventional wisdom for these wheels would be go 3 cross because that will give the spoke angle closest to perfectly tangent with the hub flange. That's generally true of 32 spoke wheels with not exceptionally large flanges.
So, at 3x we see an output of 295.6mm in front and 295.2mm in back.
Presuming the published ERD is correct, and in real life I never, ever gamble it is even though most of the time they are, in back I would do 294 with any gauge of spoke, and in front I would just do 294 as well, although with straight gauge 2.0 I'd also feel okay with 295. In this case, presuming the ERD was measured properly to represent a spoke with its tip flush with the top of the nipple, I'd expect 294 to get them both right about in that perfect range of somewhere between the base and the top of the screwdriver slot in the nipple, and with no danger of poking out the top, which I avoid at all cost. Realistically 295 would likely be fine for the front, as it may cause a slight bit (0.1-0.3mm-ish) to protrude out the top, but not more than most spoke/nipple combinations can handle. I just play it safe.
Also, everything here presumes 12mm nipples, the most common choice for handbuilt wheels. Longer nipples have more thread and change your ERD.