Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. // ARMA Hashing
  2.  
  3. MMC_fnc_hashString = {
  4. private ['_str', '_seed', '_dic', '_seedLength', '_dicLength', '_hash'];
  5. _str = toArray ([_this, 0, '', ['']] call BIS_fnc_param);
  6. _seed = toArray ([_this, 1, 'seed', ['']] call BIS_fnc_param);
  7. _dic = '0123456789abcdef';
  8. _seedLength = count _seed;
  9. _dicLength = count _dic;
  10. for "_i" from 0 to (count _str) -1 do {
  11. private ['_c', '_s', '_r'];
  12. _c = _str select _i;
  13. _s = _seed select (_i % _seedLength);
  14. _r = _s - _c;
  15. _r = abs (_r % 127);
  16. if (_r > 0) then {
  17. _seed set [(_i % _seedLength), _r];
  18. };
  19. };
  20. _hash = '';
  21. {_hash = _hash + (_dic select [_x % (count _dic), 1]);} foreach _seed;
  22. _hash
  23. };
  24.  
  25. diag_log 'Starting Hashing';
  26. private ['_start', '_seed'];
  27. _start = diag_tickTime;
  28. _seed = 'wefdfdsf2';
  29. {
  30. private ['_code', '_hash'];
  31. _code = missionNamespace getVariable [_x, ''];
  32. _hash = [str _code, _seed] call MMC_fnc_hashString;
  33. diag_log format['%1: %2', _x, _hash];
  34. } foreach [
  35. 'EPOCH_clientInit',
  36. 'EPOCH_onEachFrame',
  37. 'EPOCH_masterLoop',
  38. 'EPOCH_client_rejectPlayer',
  39. 'EPOCH_clientRespawn',
  40. 'EPOCH_KeyDown'
  41. ];
  42. diag_log format['Total Time: %1', (diag_tickTime - _start)];
  43.  
  44. /*
  45. 22:22:34 "EPOCH_clientInit: 20bca3f7c"
  46. 22:22:35 "EPOCH_onEachFrame: b4f1bd94c"
  47. 22:22:38 "EPOCH_masterLoop: 34f6d340e"
  48. 22:22:38 "EPOCH_client_rejectPlayer: 401a5c71c"
  49. 22:22:38 "EPOCH_clientRespawn: 55071b470"
  50. 22:22:40 "EPOCH_KeyDown: a8ac0bfc5"
  51. 22:22:40 "Total Time: 6.03516"
  52. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement