Seregon/ShadPKG

A tool for deriving PKG packet encryption keys for ps4 written in c++

C++/47.3 KB/No license
common/hash.h
ShadPKG / common / hash.h
1// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3 
4#pragma once
5 
6#include "common/shadpkg_types.h"
7 
8[[nodiscard]] inline u64 HashCombine(const u64 seed, const u64 hash) {
9 return seed ^ (hash + 0x9e3779b9 + (seed << 12) + (seed >> 4));
10}
11 
12[[nodiscard]] inline u32 HashCombine(const u32 seed, const u32 hash) {
13 return seed ^ (hash + 0x9e3779b9 + (seed << 6) + (seed >> 2));
14}