Example #1
0
 public static byte[] ComputeKeyedHash(IntPtr prov, CalgHash algId, byte [] data, IntPtr key)
 {
     IntPtr hash = CreateHash(prov, algId, key);
     HashData(hash, data);
     byte [] baHash = GetHashParam(hash);
     DestroyHash(hash);
     return baHash;
 }
Example #2
0
        public static IntPtr CreateHash(IntPtr prov, CalgHash algId, IntPtr key)
        {
            uint    flags = 0;
            IntPtr  hash;
            bool    retVal = NativeMethods.CryptCreateHash(prov, (uint)algId, key, flags, out hash);
            ErrCode ec     = Error.HandleRetVal(retVal);

            return(hash);
        }
Example #3
0
 public static byte[] ComputeKeyedHash(CalgHash algId, byte [] data, IntPtr key)
 {
     //dont have to specify enhanced provider,
     //because hash sizes i care about dont change
     IntPtr prov = Context.AcquireContext(ProvType.RSA_FULL);
     byte [] baHash = ComputeKeyedHash(prov, algId, data, key);
     Context.ReleaseContext(prov);
     return baHash;
 }
Example #4
0
        public static byte [] ComputeKeyedHash(IntPtr prov, CalgHash algId, byte [] data, IntPtr key)
        {
            IntPtr hash = CreateHash(prov, algId, key);

            HashData(hash, data);
            byte [] baHash = GetHashParam(hash);
            DestroyHash(hash);
            return(baHash);
        }
Example #5
0
        public static byte [] ComputeKeyedHash(CalgHash algId, byte [] data, IntPtr key)
        {
            //dont have to specify enhanced provider,
            //because hash sizes i care about dont change
            IntPtr prov = Context.AcquireContext(ProvType.RSA_FULL);

            byte [] baHash = ComputeKeyedHash(prov, algId, data, key);
            Context.ReleaseContext(prov);
            return(baHash);
        }
Example #6
0
 public static IntPtr CreateHash(IntPtr prov, CalgHash algId, IntPtr key)
 {
     uint flags = 0;
     IntPtr hash;
     bool retVal = Crypto.CryptCreateHash(prov, (uint) algId, key, flags, out hash);
     ErrCode ec = Error.HandleRetVal(retVal);
     return hash;
 }
Example #7
0
 public static IntPtr CreateHash(IntPtr prov, CalgHash algId)
 {
     IntPtr key = IntPtr.Zero; //non-keyed hash
     return CreateHash(prov, algId, key);
 }
Example #8
0
 public static byte[] ComputeHash(IntPtr prov, CalgHash algId, byte [] data)
 {
     IntPtr key = IntPtr.Zero;
     return ComputeKeyedHash(prov, algId, data, key);
 }
Example #9
0
        public static IntPtr CreateHash(IntPtr prov, CalgHash algId)
        {
            IntPtr key = IntPtr.Zero;             //non-keyed hash

            return(CreateHash(prov, algId, key));
        }
Example #10
0
        public static byte [] ComputeHash(IntPtr prov, CalgHash algId, byte [] data)
        {
            IntPtr key = IntPtr.Zero;

            return(ComputeKeyedHash(prov, algId, data, key));
        }