Could i store user geolocation data lat/lng unencr

2019-08-23 05:14发布

问题:

For a well performance on my server it`s essential that i can store latitude and longitude unencrypted. My application is based on location searches, almost every query needs to be filtered on location.
This means i have to decrypt each row of each query first before im able to get the correct rows. Thats a really big problem if there are many rows.

This way i tought for privacy i could store the values lat and lng cutted.
For example:

lat: 52.52835 
lng: 13.40547

->

lat: 52.528
lng: 13.405

Cutting on 3. decimal im recieving a rectangle with about ~ 50x80m. This might be no problem for still an accurate calculation.
Cutting on 2. decimal im recieving a rectangle with about ~ 400x700m. In worst case this can make a difference of 1km in calculation.
Instead i could add "5" as 3. decimal to improve the calculation up to 500m difference worst.

In some case it is possible that a single house is in the whole rectangle and the hacker could get the exact adress like that.

To solve that problem i could store the city location, but for bigger citys the calculation would get completely useless.

Now what you think if a hacker would be able to steal the data and get the unencrypted values, would this be a problem ?
Other suggestions to solve this problem ?

Edit:
I could also try to manipulate each value, with for example an offset to make it harder for an attacker, but that wouldnt be hard to remanipulate.

回答1:

How about making the split with . When saving to DB . Save left and right in a different column.



回答2:

Another opinion is If you have to remember by the number of letters You decide how many keys you have, and then you shift the number. This is something that only administrators should know, why not manage by setting up an anomalous key that maps to the key value of that record? There is no fixed solution.