Skip to content

Instantly share code, notes, and snippets.

@maca134
Created January 25, 2015 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maca134/d98aa47d978f0242f5c1 to your computer and use it in GitHub Desktop.
Save maca134/d98aa47d978f0242f5c1 to your computer and use it in GitHub Desktop.
// ARMA Hashing
MMC_fnc_hashString = {
private ['_str', '_seed', '_dic', '_seedLength', '_dicLength', '_hash'];
_str = toArray ([_this, 0, '', ['']] call BIS_fnc_param);
_seed = toArray ([_this, 1, 'seed', ['']] call BIS_fnc_param);
_dic = '0123456789abcdef';
_seedLength = count _seed;
_dicLength = count _dic;
for "_i" from 0 to (count _str) -1 do {
private ['_c', '_s', '_r'];
_c = _str select _i;
_s = _seed select (_i % _seedLength);
_r = _s - _c;
_r = abs (_r % 127);
if (_r > 0) then {
_seed set [(_i % _seedLength), _r];
};
};
_hash = '';
{_hash = _hash + (_dic select [_x % (count _dic), 1]);} foreach _seed;
_hash
};
diag_log 'Starting Hashing';
private ['_start', '_seed'];
_start = diag_tickTime;
_seed = 'wefdfdsf2';
{
private ['_code', '_hash'];
_code = missionNamespace getVariable [_x, ''];
_hash = [str _code, _seed] call MMC_fnc_hashString;
diag_log format['%1: %2', _x, _hash];
} foreach [
'EPOCH_clientInit',
'EPOCH_onEachFrame',
'EPOCH_masterLoop',
'EPOCH_client_rejectPlayer',
'EPOCH_clientRespawn',
'EPOCH_KeyDown'
];
diag_log format['Total Time: %1', (diag_tickTime - _start)];
/*
22:22:34 "EPOCH_clientInit: 20bca3f7c"
22:22:35 "EPOCH_onEachFrame: b4f1bd94c"
22:22:38 "EPOCH_masterLoop: 34f6d340e"
22:22:38 "EPOCH_client_rejectPlayer: 401a5c71c"
22:22:38 "EPOCH_clientRespawn: 55071b470"
22:22:40 "EPOCH_KeyDown: a8ac0bfc5"
22:22:40 "Total Time: 6.03516"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment