I was asked to encrypt/decrypt a string using MACTripleDES. Is there any difference between MACTripleDES and TripleDES? If, where exactly is the difference between both?
1 Answer
Triple DES is a block cipher. (Specifically, it's a variant of the old DES block cipher with better security, but several times lower performance.) You can use it to encrypt small blocks of data (64 bits = 8 bytes, for Triple DES), but what it's really useful for is as a building block for other cryptographic schemes, such as stream encryption or message authentication codes (MACs).
MACTripleDES is, apparently, a class in the Microsoft .NET framework that provides some kind of a MAC using Triple DES. The documentation doesn't actually seem to say which MAC construction it uses, but this answer on SO implies that it's classic CBC-MAC.
Note that raw CBC-MAC is not, by itself, secure for variable-length messages. To make it secure, you need to use one of the techniques described in the linked Wikipedia article (prepending the length to the message, encrypting the output with a different key, or using a separate MAC key for each message length), or use a more modern MAC algorithm like CMAC instead. (You may also wish to consider using a more modern cipher with a larger key and block size and better performance than Triple DES, such AES.)
ComputeHash(Byte[])
method). Also, you cannot "encrypt" or "decrypt" anything with a MAC; that's not what they're for. $\endgroup$