[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Implementation of ELF hash
From: |
Jan Seeger |
Subject: |
Implementation of ELF hash |
Date: |
Wed, 26 Jan 2022 17:09:09 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 |
Hello!
I've been recreationally hacking on an ELF file, and had a need to implement
the ELF hashing algorithm. This might be useful for other people as well, so
maybe it could be included in the ELF pickle. I've included the implementation
below.
Best regards,
Jan
fun elf_hash = (string input) Elf_Word:
{
var h = 0 as uint<32>;
var high = 0 as uint<32>;
for (c in input) {
h = (h <<. 4) + c;
high = h & 0xf0000000;
if (high) {
h = h ^ (high .>> 24);
};
h = h & ~high;
};
return h;
}
- Implementation of ELF hash,
Jan Seeger <=