MCPcopy Create free account
hub / github.com/diasurgical/devilution / Encrypt

Function Encrypt

Source/encrypt.cpp:26–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void Encrypt(void *block, DWORD size, DWORD key)
27{
28 DWORD *castBlock;
29 DWORD seed, i, ch;
30
31 castBlock = (DWORD *)block;
32 seed = 0xEEEEEEEE;
33 for (i = 0; i < (size >> 2); i++) {
34 DWORD t = ch = *castBlock;
35 seed += hashtable[0x400 + (key & 0xFF)];
36 t ^= seed + key;
37 *castBlock = SwapLE32(t);
38 seed += ch + (seed << 5) + 3;
39 key = ((~key << 0x15) + 0x11111111) | (key >> 0x0B);
40 castBlock++;
41 }
42}
43
44DWORD Hash(const char *s, int type)
45{

Callers 2

WriteBlockTableMethod · 0.85
WriteHashTableMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected