Ameisen

Untitled

Jun 10th, 2022
1,306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 KB | None | 0 0
  1. static Result Block2(uint p0, uint p1) {
  2.     p1 ^= p0;
  3.     p0 = BitOperations.RotateLeft(p0, 20);
  4.  
  5.     p0 += p1;
  6.     p1 = BitOperations.RotateLeft(p1, 9);
  7.  
  8.     p1 ^= p0;
  9.     p0 = BitOperations.RotateLeft(p0, 27);
  10.  
  11.     p0 += p1;
  12.     p1 = BitOperations.RotateLeft(p1, 19);
  13.  
  14.     return new(p0, p1);
  15. }
  16.  
  17. static Result Block3(uint p0, uint p1) {
  18.     p1 ^= p0;
  19.     p0 = BitOperations.RotateLeft(p0, 20);
  20.  
  21.     p0 += p1;
  22.     p1 = BitOperations.RotateLeft(p1, 9);
  23.  
  24.     p1 ^= p0;
  25.     p0 = BitOperations.RotateLeft(p0, 27);
  26.  
  27.     p0 += p1;
  28.     p1 = BitOperations.RotateLeft(p1, 19);
  29.  
  30.     return Result.From(p0, p1);
  31. }
  32.  
  33. [StructLayout(LayoutKind.Sequential, Pack = 4, Size = 8)]
  34. struct Result {
  35.     uint Hi;
  36.     uint Lo;
  37.    
  38.     internal static Result From(uint hi, uint lo) {
  39.         ulong temp = (((ulong)hi) << 32) | lo;
  40.         unsafe {
  41.             return *(Result*)Unsafe.AsPointer(ref temp);
  42.         }
  43.     }
  44.    
  45.     public Result(uint hi, uint lo) {
  46.         Hi = hi;
  47.         Lo = lo;
  48.     }
  49. }
  50.  
  51. ---
  52.  
  53. <Main>g__Block2|4_4 (UInt32, UInt32)
  54. L0000   push    rax
  55. L0001   xor edx, ecx
  56. L0003   rol ecx, 0x14
  57. L0006   add ecx, edx
  58. L0008   rol edx, 9
  59. L000b   xor edx, ecx
  60. L000d   rol ecx, 0x1b
  61. L0010   add ecx, edx
  62. L0012   rol edx, 0x13
  63. L0015   mov [rsp], ecx
  64. L0018   mov [rsp+4], edx
  65. L001c   mov rax, [rsp]
  66. L0020   add rsp, 8
  67. L0024   ret
  68.  
  69. <Main>g__Block3|4_5 (UInt32, UInt32)
  70. L0000   xor edx, ecx
  71. L0002   rol ecx, 0x14
  72. L0005   add ecx, edx
  73. L0007   rol edx, 9
  74. L000a   xor edx, ecx
  75. L000c   rol ecx, 0x1b
  76. L000f   add ecx, edx
  77. L0011   rol edx, 0x13
  78. L0014   mov eax, ecx
  79. L0016   shl rax, 0x20
  80. L001a   mov edx, edx
  81. L001c   or  rax, rdx
  82. L001f   ret
  83.  
Advertisement
Add Comment
Please, Sign In to add comment