public void init(byte[] key) { if(key.Length>20) { byte[] tmp=new byte[20]; Array.Copy(key, 0, tmp, 0, 20); key=tmp; } // SecretKeySpec skey=new SecretKeySpec(key, "HmacSHA1"); // mac=Mac.getInstance("HmacSHA1"); // mac.init(skey); mentalis_mac = new Org.Mentalis.SecurityServices.Cryptography.HMAC(new System.Security.Cryptography.MD5CryptoServiceProvider(), key); cs = new System.Security.Cryptography.CryptoStream( System.IO.Stream.Null, mentalis_mac, System.Security.Cryptography.CryptoStreamMode.Write); }
public void init(byte[] key) { if (key.Length > 20) { byte[] tmp = new byte[20]; Array.Copy(key, 0, tmp, 0, 20); key = tmp; } // SecretKeySpec skey=new SecretKeySpec(key, "HmacSHA1"); // mac=Mac.getInstance("HmacSHA1"); // mac.init(skey); mentalis_mac = new Org.Mentalis.SecurityServices.Cryptography.HMAC(new System.Security.Cryptography.MD5CryptoServiceProvider(), key); cs = new System.Security.Cryptography.CryptoStream(System.IO.Stream.Null, mentalis_mac, System.Security.Cryptography.CryptoStreamMode.Write); }