Advertisement
Chronos_Ouroboros

ZScript MD5 test source code

Feb 1st, 2018
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. int seed;
  2. const m = 2^32;
  3. const a = 1103515245;
  4. const c = 12345;
  5. static const int lol [] = {
  6. 18174815, 96181712, 19668646, 36117134, 51896631,
  7. 05220411, 89512542, 81114199, 18467242, 69642758,
  8. 95646984, 52559481, 45511439, 16981116, 81171454,
  9. 76387966, 37892947, 28813927, 93667962, 11718768,
  10. 66667497, 41837727, 31878474, 11362985, 41210687,
  11. 88978305, 24869181, 92453457, 15114965, 62775711,
  12. 13477844, 87148176, 14651746, 81768418, 16519841,
  13. 47981476, 76549746, 12095239, 81768416, 98165165,
  14. 98441332, 63219816, 76514987, 97654174, 51474749,
  15. 23189789, 38265928, 32421523, 78417646, 71812598
  16. };
  17. int rand () {
  18. seed = (a * seed + c) % m;
  19. return seed;
  20. }
  21.  
  22. void TestMD5 () {
  23. let arr = new ("TZK_ArrayI32");
  24.  
  25. int totalMD5Time = 0;
  26. int startTime = MSTime ();
  27. for (int i = 0; i < lol.Size (); i++) {
  28. arr.Clear ();
  29. seed = lol [i];
  30. for (int j = 0; j < (64*1024) / 4; j++) {
  31. int v = rand ();
  32. Arr.Push ( v & 0xFF);
  33. Arr.Push ((v >>> 8*1) & 0xFF);
  34. Arr.Push ((v >>> 8*2) & 0xFF);
  35. Arr.Push ((v >>> 8*3) & 0xFF);
  36. }
  37. int MD5StartTime = MSTime ();
  38. string md5 = S7_MD5.FromBytes (arr);
  39. totalMD5Time += MSTime () - MD5StartTime;
  40. Console.PrintF ("%s", md5);
  41. }
  42. int endTime = MSTime ();
  43.  
  44. Console.PrintF ("total time: %d\ntotal MD5 time: %d", endTime - startTime, totalMD5Time);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement