Hyper travel is not calculated via hypotenuese, but only in 90 degree straight lines and 45 degree angles. I do not know how the equations even work to figure out shortest distances, and the XP equation is likely a similarly confusing equation.
I don't know why it's secret, exactly. Travel time is effectively Distance / Speed, where Speed is a function of Hyper speed of the ship and your piloting skill. Exactly what weighting the Hyper and piloting skill get are the secret part.
XP = A * Distance Travelled, I don't recall what A is. 5XP per square or something.
Distance is calculated as Jev mentioned, a series of 90degree straight lines and 45 degree angles. (You can see this visualized in the City/Terrain travel where it shows a series of 45-degree moves to the adjacent row/column and several straight paths. NaviComp uses the hypotenuse, I believe, which is why it's often Off from the real times.
If we assume it'll always make you move 45 degrees when you can... I think you can approximate the calculation as follows:
point A (x y) to point B (x1 y1)
deltaX = abs(x - x1)
deltaY = abs(y - y1)
maximum path covered using 45 degree angle hops only = Min (deltaX deltaY)
Distance1 = sqrt( 2 * Min(deltaX deltaY)2)
path remaining to go is then just a straight line of length Max (deltaX deltaY) - Min(deltaX deltaY)
So Distance 2 = Max (deltaX deltaY) - Min(deltaX deltaY).
Total Distance = sqrt( 2 * Min(deltaX deltaY)2) + Max (deltaX deltaY) - Min(deltaX deltaY)
Can probably simplify that, but I'm lazy.
Time = Distance / Speed
Speed is (maybe) something like HyperVal * (a + b * PilotSkill) or maybe a * Hyperval + b * PilotSkill. You'll have to fiddle with the numbers and get some experimental data to try to approximate it if you really want a 'good enough' equation.
According to my hyper travels and XP gained for those, Jay's easy is as good as you can get for lazy persons and really accurate. Still, it would be nice if we could have something like equation for both distance and XP gain in rules.