This will generate a list of <first 8 chars of sha1 hash of IP>: mappings. once sorted, a sorted binary search tool like sgrep can be used to search for sha1-hashed IPs.
I wrote this for some testing of sudofox/mojang-blacklist. unfortunately it does still use like 94 GB of disk space to store the file and it takes a long while to sort that file once it's been generated.