2 // Mono.Security.Cryptography.SHA1CryptoServiceProvider
5 // Sebastien Pouliot (spouliot@motus.com)
7 // Copyright (C) 2003 Motus Technologies Inc. (http://www.motus.com)
11 using System.Security.Cryptography;
13 namespace Mono.Security.Cryptography {
15 public class SHA1CryptoServiceProvider : SHA1 {
17 private CapiHash hash;
19 public SHA1CryptoServiceProvider ()
24 ~SHA1CryptoServiceProvider ()
30 // a. we were calculing a hash and want to abort
31 // b. we haven't started yet
32 public override void Initialize ()
36 hash = new CapiHash (CryptoAPI.CALG_SHA1);
40 protected override void Dispose (bool disposing)
45 // there's no unmanaged resources (so disposing isn't used)
49 protected override void HashCore (byte[] rgb, int ibStart, int cbSize)
54 throw new ObjectDisposedException ("SHA1CryptoServiceProvider");
56 hash.HashCore (rgb, ibStart, cbSize);
59 protected override byte[] HashFinal ()
62 throw new ObjectDisposedException ("SHA1CryptoServiceProvider");
64 byte[] result = hash.HashFinal ();