| 3 | namespace tt::crypt { |
| 4 | |
| 5 | uint32_t djb2(const char* str) { |
| 6 | uint32_t hash = 5381; |
| 7 | char c = (char)*str++; |
| 8 | while (c != 0) { |
| 9 | hash = ((hash << 5) + hash) + (uint32_t)c; // hash * 33 + c |
| 10 | c = (char)*str++; |
| 11 | } |
| 12 | return hash; |
| 13 | } |
| 14 | |
| 15 | uint32_t djb2(const void* data, size_t length) { |
| 16 | uint32_t hash = 5381; |
nothing calls this directly
no outgoing calls
no test coverage detected