For a list of all members of this type, see MACTripleDES Members.
[Visual Basic] Public Class MACTripleDES Inherits KeyedHashAlgorithm [C#] public class MACTripleDES : KeyedHashAlgorithm [C++] public __gc class MACTripleDES : public KeyedHashAlgorithm [JScript] public class MACTripleDES extends KeyedHashAlgorithm
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
A MAC can be used to determine whether a message sent over an insecure channel has been tampered with, provided that the sender and receiver share a secret key. The sender computes the MAC for the original data, and sends both as a single message. The receiver recomputes the MAC on the received message, and checks that the computed MAC matches the transmitted MAC.
Any change to the data or the MAC will result in a mismatch, because knowledge of the secret key is required to change the message and reproduce the correct MAC. Therefore, if the codes match, the message is authenticated.
MACTripleDES uses a key of length 8, 16 or 24 bytes, and produces a hash sequence of length 8 bytes.
[Visual Basic, C#, C++] The following example computes the MAC for data using the TripleDES hash algorithm and stores it in result. This example assumes that there is a predefined constant DATA_SIZE.
[Visual Basic] Dim data(DATA_SIZE) As Byte Dim key(24) As Byte Dim mac3des As New MACTripleDES(key) Dim result As Byte() = mac3des.ComputeHash(data) [C#] byte data = new byte[DATA_SIZE]; byte key = new byte; MACTripleDES mac3des = new MACTripleDES(key); byte result = mac3des.ComputeHash(data); [C++] Byte data = new Byte[DATA_SIZE]; Byte key = new Byte; MACTripleDES* mac3des = new MACTripleDES(key); Byte result = mac3des->ComputeHash(data);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button in the upper-left corner of the page.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Mscorlib (in Mscorlib.dll)