I see no reason why that solution would not work, however, the overhead- looping all domains/elements, hashing them, then doing a key->value lookup- might not be worth the processing power. Good solution and worth looking into though!
Storing hashes in source repo would make it very hard to manage and I am not sure if processing raw names into hashes as part of build would be any help against such DMCA request.