using System; using System.Runtime.InteropServices; namespace System.Security.Cryptography { /// Computes the hash for the input data using the managed library. // Token: 0x02000531 RID: 1329 [ComVisible(true)] public class SHA384Managed : SHA384 { /// Initializes a new instance of the class. /// The Federal Information Processing Standards (FIPS) security setting is enabled. This implementation is not part of the Windows Platform FIPS-validated cryptographic algorithms. // Token: 0x060030AD RID: 12461 RVA: 0x000A70BC File Offset: 0x000A52BC public SHA384Managed() { this.xBuf = new byte[8]; this.W = new ulong[80]; this.Initialize(false); } // Token: 0x060030AE RID: 12462 RVA: 0x000A70F0 File Offset: 0x000A52F0 private void Initialize(bool reuse) { this.H1 = 14680500436340154072UL; this.H2 = 7105036623409894663UL; this.H3 = 10473403895298186519UL; this.H4 = 1526699215303891257UL; this.H5 = 7436329637833083697UL; this.H6 = 10282925794625328401UL; this.H7 = 15784041429090275239UL; this.H8 = 5167115440072839076UL; if (reuse) { this.byteCount1 = 0UL; this.byteCount2 = 0UL; this.xBufOff = 0; for (int i = 0; i < this.xBuf.Length; i++) { this.xBuf[i] = 0; } this.wOff = 0; for (int num = 0; num != this.W.Length; num++) { this.W[num] = 0UL; } } } /// Initializes an instance of . // Token: 0x060030AF RID: 12463 RVA: 0x000A71E0 File Offset: 0x000A53E0 public override void Initialize() { this.Initialize(true); } /// When overridden in a derived class, routes data written to the object into the hash algorithm for computing the hash. /// The input data. /// The offset into the byte array from which to begin using data. /// The number of bytes in the array to use as data. // Token: 0x060030B0 RID: 12464 RVA: 0x000A71EC File Offset: 0x000A53EC protected override void HashCore(byte[] rgb, int ibStart, int cbSize) { while (this.xBufOff != 0 && cbSize > 0) { this.update(rgb[ibStart]); ibStart++; cbSize--; } while (cbSize > this.xBuf.Length) { this.processWord(rgb, ibStart); ibStart += this.xBuf.Length; cbSize -= this.xBuf.Length; this.byteCount1 += (ulong)((long)this.xBuf.Length); } while (cbSize > 0) { this.update(rgb[ibStart]); ibStart++; cbSize--; } } /// When overridden in a derived class, finalizes the hash computation after the last data is processed by the cryptographic stream object. /// The computed hash code. // Token: 0x060030B1 RID: 12465 RVA: 0x000A728C File Offset: 0x000A548C protected override byte[] HashFinal() { this.adjustByteCounts(); ulong num = this.byteCount1 << 3; ulong num2 = this.byteCount2; this.update(128); while (this.xBufOff != 0) { this.update(0); } this.processLength(num, num2); this.processBlock(); byte[] array = new byte[48]; this.unpackWord(this.H1, array, 0); this.unpackWord(this.H2, array, 8); this.unpackWord(this.H3, array, 16); this.unpackWord(this.H4, array, 24); this.unpackWord(this.H5, array, 32); this.unpackWord(this.H6, array, 40); this.Initialize(); return array; } // Token: 0x060030B2 RID: 12466 RVA: 0x000A7348 File Offset: 0x000A5548 private void update(byte input) { this.xBuf[this.xBufOff++] = input; if (this.xBufOff == this.xBuf.Length) { this.processWord(this.xBuf, 0); this.xBufOff = 0; } this.byteCount1 += 1UL; } // Token: 0x060030B3 RID: 12467 RVA: 0x000A73A4 File Offset: 0x000A55A4 private void processWord(byte[] input, int inOff) { this.W[this.wOff++] = ((ulong)input[inOff] << 56) | ((ulong)input[inOff + 1] << 48) | ((ulong)input[inOff + 2] << 40) | ((ulong)input[inOff + 3] << 32) | ((ulong)input[inOff + 4] << 24) | ((ulong)input[inOff + 5] << 16) | ((ulong)input[inOff + 6] << 8) | (ulong)input[inOff + 7]; if (this.wOff == 16) { this.processBlock(); } } // Token: 0x060030B4 RID: 12468 RVA: 0x000A7428 File Offset: 0x000A5628 private void unpackWord(ulong word, byte[] output, int outOff) { output[outOff] = (byte)(word >> 56); output[outOff + 1] = (byte)(word >> 48); output[outOff + 2] = (byte)(word >> 40); output[outOff + 3] = (byte)(word >> 32); output[outOff + 4] = (byte)(word >> 24); output[outOff + 5] = (byte)(word >> 16); output[outOff + 6] = (byte)(word >> 8); output[outOff + 7] = (byte)word; } // Token: 0x060030B5 RID: 12469 RVA: 0x000A7480 File Offset: 0x000A5680 private void adjustByteCounts() { if (this.byteCount1 > 2305843009213693951UL) { this.byteCount2 += this.byteCount1 >> 61; this.byteCount1 &= 2305843009213693951UL; } } // Token: 0x060030B6 RID: 12470 RVA: 0x000A74D0 File Offset: 0x000A56D0 private void processLength(ulong lowW, ulong hiW) { if (this.wOff > 14) { this.processBlock(); } this.W[14] = hiW; this.W[15] = lowW; } // Token: 0x060030B7 RID: 12471 RVA: 0x000A74FC File Offset: 0x000A56FC private void processBlock() { ulong[] w = this.W; ulong[] k = SHAConstants.K2; this.adjustByteCounts(); ulong num; ulong num2; for (int i = 16; i <= 79; i++) { num = w[i - 15]; num = ((num >> 1) | (num << 63)) ^ ((num >> 8) | (num << 56)) ^ (num >> 7); num2 = w[i - 2]; num2 = ((num2 >> 19) | (num2 << 45)) ^ ((num2 >> 61) | (num2 << 3)) ^ (num2 >> 6); w[i] = num2 + w[i - 7] + num + w[i - 16]; } num = this.H1; num2 = this.H2; ulong num3 = this.H3; ulong num4 = this.H4; ulong num5 = this.H5; ulong num6 = this.H6; ulong num7 = this.H7; ulong num8 = this.H8; for (int j = 0; j <= 79; j++) { ulong num9 = ((num5 >> 14) | (num5 << 50)) ^ ((num5 >> 18) | (num5 << 46)) ^ ((num5 >> 41) | (num5 << 23)); num9 += num8 + ((num5 & num6) ^ (~num5 & num7)) + k[j] + w[j]; ulong num10 = ((num >> 28) | (num << 36)) ^ ((num >> 34) | (num << 30)) ^ ((num >> 39) | (num << 25)); num10 += (num & num2) ^ (num & num3) ^ (num2 & num3); num8 = num7; num7 = num6; num6 = num5; num5 = num4 + num9; num4 = num3; num3 = num2; num2 = num; num = num9 + num10; } this.H1 += num; this.H2 += num2; this.H3 += num3; this.H4 += num4; this.H5 += num5; this.H6 += num6; this.H7 += num7; this.H8 += num8; this.wOff = 0; for (int num11 = 0; num11 != w.Length; num11++) { w[num11] = 0UL; } } // Token: 0x040013D7 RID: 5079 private byte[] xBuf; // Token: 0x040013D8 RID: 5080 private int xBufOff; // Token: 0x040013D9 RID: 5081 private ulong byteCount1; // Token: 0x040013DA RID: 5082 private ulong byteCount2; // Token: 0x040013DB RID: 5083 private ulong H1; // Token: 0x040013DC RID: 5084 private ulong H2; // Token: 0x040013DD RID: 5085 private ulong H3; // Token: 0x040013DE RID: 5086 private ulong H4; // Token: 0x040013DF RID: 5087 private ulong H5; // Token: 0x040013E0 RID: 5088 private ulong H6; // Token: 0x040013E1 RID: 5089 private ulong H7; // Token: 0x040013E2 RID: 5090 private ulong H8; // Token: 0x040013E3 RID: 5091 private ulong[] W; // Token: 0x040013E4 RID: 5092 private int wOff; } }