Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure since Microsoft didn't bother to say what standard their class conforms to, but I suspect that <a href="http://www.itl.nist.gov/fipspubs/fip113.htm" rel="nofollow">this NIST document</a> is what the Microsoft class is computing, only using triple DES in place of DES.</p> <p>I guess you will have to write your own method using the primitives in mcrypt.</p> <p>EDIT 1: </p> <p>Inspired by the bounty, I have these two examples showing equivalent result in PHP and C#.</p> <p>First, C#:</p> <pre><code>using System; using System.Text; using System.Security.Cryptography; namespace TDESMacExample { class MainClass { public static void Main (string[] args) { var keyString = "012345678901234567890123"; var keyBytes = Encoding.ASCII.GetBytes(keyString); var mac = new MACTripleDES(keyBytes); var data = "please authenticate me example number one oh one point seven niner"; Console.WriteLine(data.Length); var macResult = mac.ComputeHash(Encoding.ASCII.GetBytes(data)); Console.WriteLine(BitConverter.ToString(macResult)); // B1-29-14-74-EA-E2-74-2D } } } </code></pre> <p>Next, PHP: </p> <pre><code> &lt;?php $data = 'please authenticate me example number one oh one point seven niner'; $key = '012345678901234567890123'; // Key must be 24 bytes long $iv = '\x00\x00\x00\x00\x00\x00\x00\x00'; // All zero IV is required $cipher = mcrypt_cbc(MCRYPT_3DES, $key, $data, MCRYPT_ENCRYPT, $iv); $mac_result = substr($cipher, -8); // Last 8 bytes of the cipher are the MAC echo "mac result : " . bin2hex($mac_result); echo "&lt;br&gt;"; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload