diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-25 03:07:52 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-25 03:07:52 +0100 |
| commit | 0e05e9fd34bd036e9043f20939c53edf967465ce (patch) | |
| tree | 36e3e6b84534a82c53605a19134e9ab772c11c65 /src/libDDK/DriverKit/c++/checksum.h | |
| parent | 480ccd897d21823af6128f0e3d8d8cdbf653dd0f (diff) | |
feat: CF: Add alias for CFDictionary (CFDict).v0.1.3
fix: kernel: CodeMgr improvements and fixes.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/libDDK/DriverKit/c++/checksum.h')
| -rw-r--r-- | src/libDDK/DriverKit/c++/checksum.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/libDDK/DriverKit/c++/checksum.h b/src/libDDK/DriverKit/c++/checksum.h index 34a49675..4cc87423 100644 --- a/src/libDDK/DriverKit/c++/checksum.h +++ b/src/libDDK/DriverKit/c++/checksum.h @@ -1,10 +1,39 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/nekernel-org/nekernel #ifndef DRIVERKIT_CHECKSUM_H #define DRIVERKIT_CHECKSUM_H -/// @todo Driver checksum +#include <DriverKit/c++/driver_base.h> + +namespace Kernel::DDK { + +using IndexableBlob = Char*; + +/// @note This uses the FNV 64-bit variant. +/// @brief Performs a checksum computation for a memory region. +inline UInt64 rtl_checksum(const IndexableBlob path) { + if (!path || *path == 0) return 0; + + const UInt64 kFNVSeed = 0xcbf29ce484222325ULL; + const UInt64 kFNVPrime = 0x100000001b3ULL; + + UInt64 hash = kFNVSeed; + + IndexableBlob path_ = path; + + while (*path_) { + hash ^= (Char) (*path_++); + hash *= kFNVPrime; + } + + return hash; +} + +using Blob = VoidPtr; + +} + #endif |
