Cryptography tools

ISO8583 MAC Calculator

Retail MAC
Calculate message authentication codes (Retail MAC) with DES or Triple DES for ISO8583 payments.

Calculate MAC

DES / 3DES

Enter the MAC key and data, choose algorithm and input encoding, then calculate.

For binary data, convert to hex and select Hex below.

ready
  How it works

MAC calculation

Example with data and key 01234567890123450123456789012345, Triple DES, finish also 3DES.

Triple DES needs up to 3 keys (48 hex). With a 32-hex double-length key:

  • k1 = bytes 0–8 (hex 0–16)
  • k2 = bytes 8–16 (hex 16–32)
  • k3 = same as k1 when no triple-length key
k1: 0123456789012345
k2: 0123456789012345
k3: 0123456789012345

Split data into 8-byte (16 hex) blocks. XOR each block with the previous ciphertext (CBC; first block XOR all-zeroes), then DES/3DES encrypt.

block: 0123456789012345
xor:   0123456789012345
des:   D5D16164F4B82E0F

block: 0123456789012345
xor:   D4F224037DB90D4A
des:   04D62E1385AAF220

MAC:   04D62E1385AAF220
  Related

Recent Articles on Mac