//
-// System.Security.Cryptography HashAlgorithm Class implementation
+// System.Security.Cryptography.HashAlgorithm.cs
//
// Authors:
// Matthew S. Ford (Matthew.S.Ford@Rose-Hulman.Edu)
namespace System.Security.Cryptography {
-#if NET_2_0
[ComVisible (true)]
-#endif
public abstract class HashAlgorithm : ICryptoTransform {
-#if NET_2_0
protected internal byte[] HashValue;
-#else
- protected byte[] HashValue;
-#endif
protected int HashSizeValue;
protected int State;
private bool disposed;
Dispose (true);
}
- public byte[] ComputeHash (byte[] input)
+ public byte[] ComputeHash (byte[] buffer)
{
- if (input == null)
- throw new ArgumentNullException ("input");
+ if (buffer == null)
+ throw new ArgumentNullException ("buffer");
- return ComputeHash (input, 0, input.Length);
+ return ComputeHash (buffer, 0, buffer.Length);
}
public byte[] ComputeHash (byte[] buffer, int offset, int count)
public static HashAlgorithm Create ()
{
+#if FULL_AOT_RUNTIME
+ return new System.Security.Cryptography.SHA1CryptoServiceProvider ();
+#else
return Create ("System.Security.Cryptography.HashAlgorithm");
+#endif
}
public static HashAlgorithm Create (string hashName)
}
}
- protected abstract void HashCore (byte[] rgb, int start, int size);
+ protected abstract void HashCore (byte[] array, int ibStart, int cbSize);
protected abstract byte[] HashFinal ();
get { return 1; }
}
+#if NET_4_0
+ public void Dispose ()
+#else
void IDisposable.Dispose ()
+#endif
{
Dispose (true);
GC.SuppressFinalize (this); // Finalization is now unnecessary
if (outputBuffer != null) {
if (outputOffset < 0) {
-#if NET_2_0
throw new ArgumentOutOfRangeException ("outputOffset", "< 0");
-#else
- throw new IndexOutOfRangeException ("outputBuffer");
-#endif
}
// ordered to avoid possible integer overflow
if (outputOffset > outputBuffer.Length - inputCount) {
-#if NET_2_0
throw new ArgumentException ("outputOffset + inputCount",
Locale.GetText ("Overflow"));
-#else
- throw new IndexOutOfRangeException ("outputBuffer");
-#endif
}
}