shipping calculated per mile

Has anyone every configured or have a mod for calculating shipping based on mileage. I'd like to charge $x.xx per mile from originating zip code to shipping destination zip code. Just plug in logic to find the actual mileage and charge $x.xx per mile and that is what shows up for shipping.

Would just be a custome shipping module. But it would require the ability to calculate distance between the origin and desitination zip codes and the granularity would not be very high.