Overview
src/Common is not a compiled project. It contains no .csproj, no AssemblyInfo, and no NuGet package manifest. Instead it is a bare source-file directory used as a solution-folder grouping in several Visual Studio solution files (NuGet.Jobs.sln, NuGet.Jobs.FunctionalTests.sln). Its only current content is a single .cs file that was copied verbatim from the retired ASP.NET Web Stack CodePlex repository and is licensed under the Apache 2.0 License.
The file that lives here — HashCodeCombiner.cs — provides a small, stateful hash-accumulator class. It uses the djb2 polynomial rolling-hash algorithm (hash = (hash << 5) + hash ^ value) seeded at 0x1505 to combine the hash codes of arbitrarily many objects, integers, or collections into a single int. Because the class is declared internal, any project that needs it must either include this file directly as a linked source item, or copy it locally.
The namespace was deliberately changed from the original Microsoft namespace to NuGet.Services so that callers in the NuGet Gallery source tree can use the type without adding an extra using directive.
Role in System
HashCodeCombiner must reference the file explicitly (e.g., via a <Compile Include="..." Link="..."> item in their .csproj). There are no .csproj-level references to this directory currently active in the repository.
Vendored Utility
HashCodeCombiner.cs is a verbatim copy of a file from the retired aspnetwebstack CodePlex project, retained under its original Apache 2.0 license. No modifications were made to the algorithm; only the namespace was changed.No Build Artifact
The directory produces no
.dll, NuGet package, or other build output. It is a source-sharing mechanism only, organized as a solution folder in Visual Studio rather than as a standalone C# project.djb2 Hash Algorithm
The combiner seeds at
0x1505 and accumulates values using hash = (hash << 5) + hash ^ value, the classic djb2 polynomial variant. The final int result is obtained by calling .GetHashCode() on the internal long accumulator.Fluent Builder API
All
Add overloads return this, enabling a fluent chain: HashCodeCombiner.Start().Add(a).Add(b).CombinedHash. Null objects and null enumerables are handled gracefully (treated as hash value 0).Key Files and Classes
| File | Class / Type | Purpose |
|---|---|---|
HashCodeCombiner.cs | HashCodeCombiner (internal) | Accumulates hash codes for multiple objects, integers, or IEnumerable sequences into a single combined int using the djb2 polynomial algorithm. Provides a static Start() factory and fluent Add overloads. |
Dependencies
NuGet Package References
None. The directory contains no project file and declares no package dependencies.Internal Project References
None.src/Common is not a project; it carries no <ProjectReference> entries.
Notable Patterns and Implementation Details
Not a compilable project.
src/Common has no .csproj file. It appears in solution files purely as a Visual Studio solution folder for organizational grouping. The directory cannot be built independently with dotnet build or msbuild.Namespace intentionally changed from the original. The file comment explicitly states: “Namespace changed from original to avoid requiring using statements.” The class lives in
NuGet.Services rather than in any Microsoft-owned namespace so that consuming code in the NuGet.Services.* project tree can use it without an extra using directive.