A single company could easily own all 256 IP addresses in 215.54.87.*. (Larger companies can own even larger blocks of IP addresses.) So just dropping the last number doesn't offer much anonymity. For example, once somebody traced the address down to XYZ Company, that company might be able to give them a log of all outgoing traffic tied to specific employees' machines. Even an ISP might be able to link a partial IP address to a specific user if they can search their logs for a specific date/time/destination.
(Note: '387' could never be a component of an IPv4 address, since each component is 8 bits, or 0-255.)
I thought I'd break it up since it really is 2 questions.
b) You can't maintain a 1:1 mapping and anonymity, if I know your algorithm it's trivial to try all IP addresses and get a mapping to do a reverse look up. You need to throw away data to make it ambiguous, e.g. in probabilistic data structures like bloom filters.
I don't know what a snooper would want with the HTTP referrer information.
https://en.wikipedia.org/wiki/Hash-based_message_authenticat...