// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
+#if !MOONLIGHT
using System.Runtime.InteropServices;
/// <param name="ibStart">The offset into the byte array from which to begin using data.</param>
/// <param name="cbSize">The number of bytes in the array to use as data.</param>
/// <exception cref="ObjectDisposedException">The <see cref="RIPEMD160Managed"/> instance has been disposed.</exception>
- protected override void HashCore(byte[] array, int ibStart, int cbSize) {
+ protected override void HashCore(byte[] rgb, int ibStart, int cbSize) {
int i;
State = 1;
if (_ProcessingBufferCount != 0) {
if (cbSize < (BLOCK_SIZE_BYTES - _ProcessingBufferCount)) {
- System.Buffer.BlockCopy (array, ibStart, _ProcessingBuffer, _ProcessingBufferCount, cbSize);
+ System.Buffer.BlockCopy (rgb, ibStart, _ProcessingBuffer, _ProcessingBufferCount, cbSize);
_ProcessingBufferCount += cbSize;
return;
} else {
i = (BLOCK_SIZE_BYTES - _ProcessingBufferCount);
- System.Buffer.BlockCopy (array, ibStart, _ProcessingBuffer, _ProcessingBufferCount, i);
+ System.Buffer.BlockCopy (rgb, ibStart, _ProcessingBuffer, _ProcessingBufferCount, i);
ProcessBlock (_ProcessingBuffer, 0);
_ProcessingBufferCount = 0;
ibStart += i;
}
}
- for (i=0; i<cbSize-cbSize%BLOCK_SIZE_BYTES; i += BLOCK_SIZE_BYTES) {
- ProcessBlock (array, ibStart+i);
+ for (i = 0; i < cbSize - cbSize % BLOCK_SIZE_BYTES; i += BLOCK_SIZE_BYTES) {
+ ProcessBlock (rgb, ibStart + i);
}
- if (cbSize%BLOCK_SIZE_BYTES != 0) {
- System.Buffer.BlockCopy (array, cbSize-cbSize%BLOCK_SIZE_BYTES+ibStart, _ProcessingBuffer, 0, cbSize%BLOCK_SIZE_BYTES);
- _ProcessingBufferCount = cbSize%BLOCK_SIZE_BYTES;
+ if (cbSize % BLOCK_SIZE_BYTES != 0) {
+ System.Buffer.BlockCopy (rgb, cbSize - cbSize % BLOCK_SIZE_BYTES + ibStart, _ProcessingBuffer, 0, cbSize % BLOCK_SIZE_BYTES);
+ _ProcessingBufferCount = cbSize % BLOCK_SIZE_BYTES;
}
}
/// <summary>
protected override byte[] HashFinal() {
CompressFinal(_Length);
byte[] hash = new byte[20];
- if (BitConverter.IsLittleEndian) {
+ if (!BitConverter.IsLittleEndian) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 4; j++) {
hash [i*4+j] = (byte)(_HashValue [i] >> j*8);
}
return hash;
}
- /// <summary>
- /// Finalizes the RIPEMD160Managed.
- /// </summary>
- ~RIPEMD160Managed() {
- Dispose(false);
- }
/// <summary>
/// Processes one block of data.
/// <param name="offset">The offset in the buffer.</param>
private void ProcessBlock (byte[] buffer, int offset)
{
- if (BitConverter.IsLittleEndian) {
+ if (!BitConverter.IsLittleEndian) {
for (int i=0; i < _X.Length; i++) {
_X [i] = (uint)(buffer [offset])
| (((uint)(buffer [offset+1])) << 8)