1 | // |
2 | // Hash.cpp |
3 | // |
4 | // Library: Foundation |
5 | // Package: Hashing |
6 | // Module: Hash |
7 | // |
8 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
9 | // and Contributors. |
10 | // |
11 | // SPDX-License-Identifier: BSL-1.0 |
12 | // |
13 | |
14 | |
15 | #include "Poco/Hash.h" |
16 | |
17 | |
18 | namespace Poco { |
19 | |
20 | |
21 | std::size_t hash(const std::string& str) |
22 | { |
23 | std::size_t h = 0; |
24 | std::string::const_iterator it = str.begin(); |
25 | std::string::const_iterator end = str.end(); |
26 | while (it != end) |
27 | { |
28 | h = h * 0xf4243 ^ *it++; |
29 | } |
30 | return h; |
31 | } |
32 | |
33 | |
34 | } // namespace Poco |
35 | |