Skip to content
Snippets Groups Projects
Commit d88a3faf authored by Jano Hendriks's avatar Jano Hendriks
Browse files

Added type to address hash (if it is not unknown)

parent 27623fdc
No related branches found
No related tags found
No related merge requests found
......@@ -9,12 +9,16 @@ import (
)
// MD5HashOfAddress m(E,L,L) - calculates and returns the MD5 hash of the entered address, lat and lng concatenated together. If lat and lng is blank, it is only the hash of the entered address
func MD5HashOfAddress(enteredAddress string, lat *float64, lng *float64) string {
func MD5HashOfAddress(enteredAddress string, lat *float64, lng *float64, addressType *string) string {
valueToHash := enteredAddress
if lat != nil && lng != nil {
valueToHash += fmt.Sprintf(",%v,%v", *lat, *lng)
}
if addressType != nil && len(*addressType) > 0 && *addressType != "unknown" {
valueToHash += fmt.Sprintf(",%s", *addressType)
}
return fmt.Sprintf("%X", md5.Sum([]byte(valueToHash)))
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment