1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2025-08-21 15:54:06 +02:00
Files
.config
.run
.workdir
Agent
Common
Controller
Docker
Utils
Phantom.Utils
Collections
Cryptography
Base24.cs
Sha1String.cs
StableHashCode.cs
TokenGenerator.cs
IO
Processes
Runtime
Tasks
Threading
Phantom.Utils.csproj
Phantom.Utils.Actor
Phantom.Utils.Events
Phantom.Utils.Logging
Phantom.Utils.Rpc
Phantom.Utils.Tests
Web
.dockerignore
.gitattributes
.gitignore
AddMigration.bat
AddMigration.sh
Directory.Build.props
Directory.Build.targets
Dockerfile
LICENSE
Packages.props
PhantomPanel.sln
README.md
global.json
Minecraft-Phantom-Panel/Utils/Phantom.Utils/Cryptography/StableHashCode.cs

22 lines
439 B
C#

namespace Phantom.Utils.Cryptography;
public static class StableHashCode {
public static int ForString(string str) {
unchecked {
int hash1 = (5381 << 16) + 5381;
int hash2 = hash1;
for (int i = 0; i < str.Length; i += 2) {
hash1 = ((hash1 << 5) + hash1) ^ str[i];
if (i == str.Length - 1) {
break;
}
hash2 = ((hash2 << 5) + hash2) ^ str[i + 1];
}
return hash1 + (hash2 * 1566083941);
}
}
}