Payment Utilities
PIN block encoding across the ISO 9564 formats and OEM variants, AES-encrypted PIN blocks, TPK-to-ZPK translation and DUKPT PIN encryption — alongside the AS2805, DUKPT, card-verification, MAC and bitmap utilities in the same group. Each tool validates inputs in real time and logs every operation for audit.
On this page
Introduction
A PIN block is a fixed-format encoding of a cardholder PIN designed to be encrypted under a key (TPK, ZPK, or DUKPT-derived) and transmitted across a payment network. ISO 9564 defines the canonical formats; vendors and legacy networks add a few non-standard variants you may still encounter.
The PIN calculators live in Tools → Payment Utilities, alongside the card-verification, DUKPT and MAC tools. Two of them are dedicated PIN tools — PIN Block Calculator and PIN Block (AES) — and two more tools in the group carry PIN block operations of their own, covered in PIN Block Translation and DUKPT PIN below.
The rest of the group follows, one screen at a time: the other three AS2805 Calculator tabs, the DUKPT Utilities derivation and operation tabs and their AES counterpart, the AMEX CSC and MasterCard CVC3 calculators, the four MAC calculators and the Bitmap Calculator.
All tools
Every tool in this category — each card links to the detailed reference below.
PIN Block Formats
| Format | Source | PAN-bound? | Notes |
|---|---|---|---|
| ISO-0 | ISO 9564-1 | Yes | PIN XOR PAN. Most common in legacy systems. Equivalent to ANSI X9.8. |
| ISO-1 | ISO 9564-1 | No | PIN + random padding. Used when PAN is not available. |
| ISO-2 | ISO 9564-1 | No | PIN + F padding. EMV ICC offline PIN. |
| ISO-3 | ISO 9564-1 | Yes | Like ISO-0 but with random fill nibbles instead of zeros. |
| ISO-4 | ISO 9564-1 (2017) | Yes | 16-byte block; AES-only. Currently mandated for new deployments. |
| OEM-1 | Diebold / Docutel / NCR | Varies | Vendor-specific historical formats — rarely needed for new work. |
| ECI 1-4 | Eurocheque / EFT | Varies | European legacy variants. |
PIN Block Calculator
The PIN Block Calculator builds a formatted PIN block, or recovers the PIN from one. The format is picked once from the PIN block format drop-down at the top of the screen; Encode and Decode sit below it as a tab pair, so the same format applies in both directions.
pin-tools · PIN Block Calculator — Format 0 (ISO-0) selected in the PIN block format drop-down, the Encode tab active, and PAN and PIN fields above the Encode button
Inputs
- PIN block format — Drop-down covering the ISO 9564 formats and the OEM / ECI variants.
Format 0 (ISO-0)is the default. - PAN — Only the PAN-bound formats ask for it; the field reads PAN is required for this format when the current selection needs one.
- PIN — 4–12 numeric digits.
The rest of the form follows the format you pick, so a format that carries no PAN simply drops that field.
Walk-through (Encode, ISO-0)
- Open the PIN Block Calculator from
Tools → Payment Utilities → PIN Block Calculator. - Pick Format 0 (ISO-0) in the PIN block format drop-down.
- Stay on the Encode tab.
- Enter the PAN. ISO-0 uses the rightmost 12 digits excluding the check digit.
- Enter the PIN (e.g.
1234). - Click Encode. The formatted PIN block is written to the activity log with its inputs.
The Decode tab reverses the same format: give it the PIN block and it recovers the PIN.
pin-tools · PIN Block Calculator — the Decode tab of the same tool — the PIN block in, the PIN out
Format Walk-throughs
ISO-0 / ANSI X9.8
Step 1 (PIN block): 04 12 34 FF FF FF FF FF - 04 = PIN length (4 digits) - 1234 = PIN - FF padding to 8 bytes Step 2 (PAN block): 00 00 12 34 56 78 90 12 - leading zeros + rightmost 12 digits of PAN excluding check digit Step 3 (XOR): 04 12 26 CB A9 87 6F ED Step 4 (Encrypt): encrypted under TPK / ZPK
ISO-1
No PAN; the PIN is followed by random fill bytes. Use when PAN is not transmitted (e.g. some IVR / VRU flows).
ISO-3
Like ISO-0 but the padding nibbles are random in the range 0xA–0xF. Each generated PIN block is unique even for the same PIN + PAN combination.
ISO-4 (AES)
16-byte clear PIN block: control field, PIN length, PIN digits, then a random fill. Encrypted with AES (128 / 192 / 256-bit) and XOR-combined with a derived PAN block. Use the dedicated AES PIN Block tab for ISO-4 work.
OEM-1 / ECI
Reserved for compatibility with legacy ATM and POS networks. The exact layout differs per vendor; the calculator labels each tab with the vendor name.
AES PIN Block (ISO-4) Calculator
The PIN Block (AES) tool focuses on the modern ISO Format 4 design. One form covers both directions — Encode and Decode are buttons rather than tabs, and the middle field changes meaning between them.
pin-tools · PIN Block (AES) Calculator — a 32-hex Key field, the combined PIN (Encode) / PIN Block (Decode) field, a PAN field, and Encode and Decode buttons
Inputs
- Key — 32 hex chars (AES-128).
- PIN (Encode) / PIN Block (Decode) — One field serving both directions: the PIN going in, the encrypted block coming back out.
- PAN — Required for the PAN block XOR step.
Buttons: Encode, Decode.
Output
- Clear PIN block (16 bytes)
- PAN block (16 bytes)
- Intermediate ciphertext (after AES of clear PIN block)
- Final encrypted PIN block (after XOR with PAN block)
PIN Block Translation (AS2805)
Translation re-encrypts a PIN block from one key to another without ever exposing the clear PIN — the acquiring step that moves a PIN from the terminal key (TPK) it arrived under to the zone key (ZPK) shared with the next node. The AS2805 Calculator carries it on its Translate PIN Block tab, and can change the PIN block format in the same operation.
pin-tools · AS2805 Calculator — System ZPK and Terminal TPK hex fields, STAN, Transaction Amount, incoming and outgoing PIN block format selectors, the incoming PIN block and an account number, above a Translate button
Inputs
- System ZPK (Hex) — The zone key the block is translated to.
- Terminal TPK (Hex) — The terminal key the block arrived under.
- STAN — System trace audit number of the transaction.
- Transaction Amount
- Incoming / Outgoing PIN Block Format — Two-digit format codes, defaulting to
01. Set them differently to translate the format as well as the key. - Incoming PIN Block (Hex)
- Account Number — Binds the block for the PAN-bound formats.
Button: Translate.
Tools → Payment Utilities → AS2805 Calculator and pick the Translate PIN Block tab. The same tool also generates terminal key sets and computes AS2805 MACs and one-way functions.AS2805 Calculator
The AS2805 Calculator is one tool with four tabs — Generate Terminal Key Set, Translate PIN Block, MAC and OWF. Translation is covered above; the other three tabs share the same form-and-log layout.
Generate Terminal Key Set
Creates the terminal keys — TPK and TAK — an AS2805 terminal receives at logon, wrapped under the receiving key-encrypting key.
pin-tools · AS2805 Calculator — Key Flag, KEKr Key, the KEKE and LMK key schemes and the key check value type above Generate Keys
- Key Flag — Drop-down;
1by default. - KEKr Key (Hex) — The receiving KEK the new set is wrapped under.
- Key Scheme KEKE / Key Scheme LMK — Drop-downs,
BandZby default — the scheme tags for the KEK-wrapped and LMK-wrapped copies. - Key Check Value Type — Drop-down;
1by default.
- Open
Tools → Payment Utilities → AS2805 Calculator; the tool opens on Generate Terminal Key Set. - Enter the KEKr key. Leave the key flag, schemes and KCV type at their defaults unless your host specifies otherwise.
- Click Generate Keys. The TPK and TAK land in the activity log with their key check values.
MAC
pin-tools · AS2805 Calculator — Key (Hex) and Data (Hex) above Calculate MAC
Two hex fields — Key (Hex) and Data (Hex) — and a Calculate MAC button. The MAC is computed to AS 2805.4 over the data under the key you give it.
OWF
pin-tools · AS2805 Calculator — Key (Hex) and Data (Hex) above Calculate OWF
The one-way function used in AS2805 key management. Same two fields; Calculate OWF writes the result to the log.
DUKPT PIN
Under DUKPT, the PIN is encrypted with a PIN Entry Key (PEK) derived per transaction rather than a static TPK. The DUKPT PIN tab takes a PEK you have already derived and encrypts or decrypts a PIN block with it.
pin-tools · DUKPT Utilities — a 32-hex PEK field and a 16-hex PIN Block field above Encrypt and Decrypt buttons
Inputs
- PEK — 32 hex chars. Derive it first on the PEK Derivation tab from a BDK or IPEK plus the KSN.
- PIN Block — 16 hex chars: the clear block to encrypt, or the encrypted block to recover.
Buttons: Encrypt, Decrypt.
DUKPT Utilities
Derived Unique Key Per Transaction generates a fresh key for every transaction without ever transmitting it: the terminal holds an IPEK derived from a BDK and a KSN, advances the KSN counter each time, and the host — knowing only the BDK and the KSN it received — derives the same key independently. The DUKPT Utilities tool implements ANSI X9.24-1 with 3DES across five tabs: two derivation tabs that produce working keys and three operation tabs that consume them. DUKPT AES Utilities does the same for ANSI X9.24-3. For the derivation walk-through, KSN layout and the X9.24 test vectors, the reference page is DUKPT Tools; the MAC calculators have their own page at MAC Tools.
| Variant | Standard | Cipher | BDK | KSN |
|---|---|---|---|---|
| DUKPT ISO 9797 | ANSI X9.24-1 | 3DES | 16 bytes (32 hex) | 10 bytes (20 hex) |
| DUKPT AES | ANSI X9.24-3 | AES-128 / 192 / 256 | 16 / 24 / 32 bytes | 12 bytes (24 hex) |
PEK Derivation
pin-tools · DUKPT Utilities — BDK selected as the input key designation, the BDK and KSN fields and Derive PEK — run on the X9.24 sample BDK and KSN
- Input Key Designation — Drop-down:
BDKorIPEK. Determines which key field is shown. - BDK (32 Hex Chars) / IPEK (32 Hex Chars) — Whichever the designation asks for.
- KSN (20 Hex Chars) — Always visible; the rightmost 21 bits are the transaction counter.
- Pick Input Key Designation —
BDKif you have the base key,IPEKif a previous step already produced the initial key. - Enter the key in the resulting BDK or IPEK field (32 hex chars).
- Enter the KSN (20 hex chars).
- Click Derive PEK. The activity log shows the resulting PIN Encryption Key — copy it for the operation tabs.
DEK Derivation
pin-tools · DUKPT Utilities — the same designation, BDK and KSN fields above Derive DEK
Identical fields and flow to PEK Derivation — the only difference is the variant applied, which produces a Data Encryption Key instead.
DUKPT MAC
pin-tools · DUKPT Utilities — a PEK field, the DES / 3DES algorithm radio pair and a hex Data field above Generate MAC
- PEK (32 Hex Chars) — The MAC key, typically derived on the PEK Derivation tab.
- Algorithm — Radio:
DESor3DES. - Data (Hex) — Multi-line hex input.
Button: Generate MAC.
DUKPT Data
pin-tools · DUKPT Utilities — a PEK field, the Use Data Variant Key switch, the ASCII data input type, the CBC / ECB cipher-mode radio pair and a Data field above Encrypt and Decrypt
- PEK (32 Hex Chars) — Working key from PEK Derivation, or from DEK Derivation when the data variant is required.
- Use Data Variant Key — Switch. When on, the tool applies the data-encryption variant XOR before encrypting.
- Data Input Type —
ASCIIorHex. - Cipher Mode (zero IV) — Radio:
CBCorECB. - Data — Multi-line input in the chosen format.
Buttons: Encrypt, Decrypt.
DUKPT AES Utilities · Key Derivation
The AES tool implements ANSI X9.24-3. Four tabs — Key Derivation, DUKPT PIN, DUKPT MAC, DUKPT Data — split derivation from operations the same way.
pin-tools · DUKPT AES Utilities — the Key Derivation tab — BDK as the input key designation, AES-128 initial and working key types, BDK / IK and KSN fields above Derive Keys
- Input Key Designation —
BDKorIK. - Initial Key Type — Drop-down:
AES-128,AES-192,AES-256. - BDK / IK — Hex; length matches the initial key type.
- Working Key Type — Drop-down:
2TDEA,3TDEA,AES-128,AES-192,AES-256— TDES working keys too, for backwards compatibility. - KSN — 24 hex chars: 4-byte BDK ID, 4-byte derivation ID, 4-byte counter.
- Pick Input Key Designation and Initial Key Type.
- Enter the BDK / IK.
- Pick Working Key Type and enter the KSN.
- Click Derive Keys. The activity log lists the IK (when starting from a BDK) and the working key.
3DES KSN (10 bytes) | 5-byte BDK ID + Device ID | 2-byte counter (high) | 21-bit Tx Counter | AES KSN (12 bytes) | 4-byte BDK ID | 4-byte Derivation ID | 4-byte Transaction Counter |
AMEX CSC & MasterCard CVC3
Two issuer-side calculators for card security values. Each has a Generate tab and a Validate tab: Validate takes the same inputs plus the value under test and reports whether it matches. The card-verification reference page is Card Validation.
AMEX CSC Calculator
pin-tools · Amex CSC Calculator — the Generate tab — CSC Version, CSC Key, PAN, Expiration Date, Service Code and Verification Value Type above Generate
- CSC Version — Drop-down;
Version 1by default. - CSC Key (Hex) — The Amex CSC key.
- PAN — 15-digit Amex account number.
- Expiration Date (YYMM) — Four digits.
- Service Code — Three digits.
- Verification Value Type — Drop-down;
CSCby default.
- Open
Tools → Payment Utilities → AMEX CSC; the tool opens on Generate. - Pick the CSC Version, then enter the CSC Key, PAN, expiry and service code.
- Click Generate. The activity log lists the CSC-5, CSC-4 and CSC-3 values.
- To check values from a card, switch to Validate: enter the same PAN, expiry and service code, then the CSC-5, CSC-4 and CSC-3 you were given, and click Validate.
pin-tools · Amex CSC Calculator — the Validate tab — PAN, Expiration Date, Service Code and Verification Value Type, then the three values to validate
MasterCard CVC3
pin-tools · MasterCard CVC3 — the Generate tab — IMK, PAN, PAN Seq No, Track 1/2 Data, Unpredictable Num, ATC and CVC3 Type above Generate
- IMK — The issuer master key for CVC3.
- PAN / PAN Seq No — Derive the card key from the IMK.
- Track 1/2 Data — The track data the CVC3 is computed over.
- Unpredictable Num — The terminal’s unpredictable number, hex.
- ATC — Application transaction counter, hex.
- CVC3 Type — Drop-down;
Dynamic CVC3by default.
- Open
Tools → Payment Utilities → MasterCard CVCon the Generate tab. - Enter the IMK, PAN and PAN sequence number, then the track data, unpredictable number and ATC from the transaction.
- Click Generate. The log shows the derived key, the IVCVC3 and the CVC3.
- On Validate, add the Dynamic CVC3 received from the card and click Validate to compare.
pin-tools · MasterCard CVC3 — the Validate tab — the same inputs plus a Dynamic CVC3 field to check
MAC Calculators
A Message Authentication Code is a short tag computed from a message and a secret key; the receiver recomputes it to confirm the message was not altered and came from someone holding the same key. Payment networks rely on MACs on ISO 8583 messages, terminal-host links and PIN-translation pipelines. The group carries a calculator for every MAC algorithm commonly seen in payment specifications — the block-cipher family, and HMAC for hash-based tags. The dedicated reference for ISO 9797-1, X9.9/X9.19 and HMAC — with the worked vectors — is MAC Tools.
| Algorithm | Standard | Block / Cipher | Common use |
|---|---|---|---|
| HMAC | RFC 2104, FIPS 198-1 | Hash (SHA-256, etc.) | API authentication, JWS, payment APIs. |
| CMAC | NIST SP 800-38B | AES / TDES | EMV-like cryptograms, modern PIN translation. |
| TDES CBC-MAC | ANSI X9.9 (legacy) | 3DES | Older banking integrations. |
| ANSI X9.19 MAC | ANSI X9.19 | Single DES + 3DES finalize | U.S. retail / banking ISO 8583. |
| ISO 9797 MAC | ISO/IEC 9797-1 | DES / 3DES / AES | Cross-network ISO 8583 MACs. |
| Retail MAC | ISO 9797-1 Algorithm 3 | 3DES | European retail payments. |
| AS2805 MAC | AS 2805.4 | 3DES | Australian payment systems. |
ISO/IEC 9797-1
ISO/IEC 9797-1 standardises six MAC algorithms over block ciphers; the calculator exposes each from the MAC Algorithm drop-down.
pin-tools · ISO/IEC 9797-1 MAC — Algorithm 1 selected, the Key (K′) field, Padding, Data and Truncation Length above Generate MAC — the worked example below, "Hello" under Method 2 padding
| Variant | Description | Typical cipher |
|---|---|---|
| Algorithm 1 | Plain CBC-MAC. Single key. Last block is the MAC. | DES / 3DES / AES |
| Algorithm 2 | Last block encrypted with a derived key (K′). | DES |
| Algorithm 3 | Retail MAC: single DES CBC-MAC, then 3DES finalize. Equivalent to ANSI X9.19. | DES + 3DES |
| Algorithm 4 | CBC-MAC with two parallel CBC-MAC chains XOR-combined. | DES / 3DES |
| Algorithm 5 | EMAC: CBC-MAC re-encrypted with a second key. | AES |
| Algorithm 6 | MAC double-CBC encryption with separate keys. | AES |
- MAC Algorithm — Drop-down,
Algorithm 1throughAlgorithm 6. - Key (K′) — Hex; the algorithms that need a second key derive it from this one.
- Padding — Drop-down:
Method 1,Method 2,Method 3. - Data (Hex) — The message to authenticate.
- Truncation Length (Chars) — Defaults to
8.
- Open
Tools → Payment Utilities → ISO/IEC 9797-1. - Pick the MAC Algorithm and Padding your host specifies — Algorithm 1 with TDES is widespread for ISO 8583 MAC fields (bit 64 / 128); Algorithm 3 is the European retail standard.
- Enter the key and the hex data, and set the truncation length.
- Click Generate MAC. The padded data, the full MAC and the truncated MAC are written to the log.
Key: 0123456789ABCDEFFEDCBA9876543210 IV: 0000000000000000 Method: 2 (0x80 followed by zero bytes) Data: 48656C6C6F (ASCII "Hello") Padded: 48656C6C6F800000 Output: 8F9E4CCDD623E590
ANSI X9.9 & X9.19
One tool covers both ANSI schemes — X9.9 (wholesale) and X9.19 (retail) — selected from the MAC Algorithm drop-down. X9.19 runs single-DES CBC-MAC across the message with a final 3DES step over the last block, which makes it equivalent to ISO 9797-1 Algorithm 3.
pin-tools · ANSI X9.9 & X9.19 — ANSI MAC X9.9 (Wholesale MAC) selected, Key (K), Data and Truncation Length above Generate MAC
- MAC Algorithm —
ANSI MAC X9.9 (Wholesale MAC)or the X9.19 retail variant. - Key (K) — Hex key; the 3DES halves are taken from it in order.
- Data (Hex) — The message to authenticate.
- Truncation Length (Chars) — Defaults to
8.
TDES-CBC MAC
Triple-DES CBC-MAC: encrypt the message under TDES in CBC mode and take the last block as the MAC. Common in legacy ISO 8583 implementations.
pin-tools · TDES-CBC MAC Calculator — the fixed TDES CBC-MAC algorithm, a 32-hex Key (K), ISO9797-1 Padding Method 1, Data and Truncation Length above Generate MAC
- MAC Algorithm — Fixed to
TDES CBC-MACon this tool. - Key (K) — 32 hex chars (2-key 3DES).
- Padding — Drop-down; defaults to
ISO9797-1 (Padding Method 1). - Data (Hex) — The message to authenticate.
- Truncation Length (Chars) — Hex characters of MAC to keep; defaults to
8.
HMAC
Hash-based MAC defined by RFC 2104. Key and data are each entered as ASCII or hexadecimal; the output is hex of the digest length — 32 bytes for SHA-256, 64 for SHA-512.
pin-tools · HMAC MAC Calculator — SHA-256 as the hash type, a hex key and ASCII data, the HMAC Key and Data fields above Generate HMAC — RFC 4231 test case 2
- Hash Type — Drop-down:
MD5,SHA-1,SHA-224,SHA-256,SHA-384,SHA-512,RIPEMD-160. - Key Input / Data Input — Drop-downs:
ASCIIorHexadecimal. - HMAC Key — Single-line text in the chosen format.
- Data — Multi-line text in the chosen format.
- Pick Hash Type —
SHA-256is a safe default for new work. - Pick Key Input and enter the HMAC Key in that format.
- Pick Data Input and enter the Data.
- Click Generate HMAC. The digest is appended to the activity log.
Padding methods (ISO 9797-1)
| Method | Rule | Notes |
|---|---|---|
| Method 1 | Append 00 bytes to the next block boundary. | Simple but ambiguous — cannot distinguish trailing zeros in plaintext. |
| Method 2 | Append a single 80 byte, then 00 bytes. | Self-describing and unambiguous. Recommended. |
| Method 3 | Prefix the message with its length, then pad with 00. | Used in some legacy systems; rare in payments. |
Bitmap Calculator
An ISO 8583 bitmap declares which data elements follow the message type: 64 bits, one per field, with bit 1 announcing that a secondary bitmap for fields 65–128 is present. The Bitmap Calculator works in both directions — toggle the fields present and read the hex, or paste a bitmap and see the fields it declares.
pin-tools · Bitmap Calculator — the calculated bitmap with its copy button, and the primary (1–64) and secondary (65–128) grids with the present fields lit
- Open
Tools → Payment Utilities → Bitmap Calculator. - Click the fields present in your message in the Primary Bitmap (1-64) grid. Click any field above 64 in the Secondary Bitmap (65-128) grid and field 1 switches on by itself.
- Read the Calculated Bitmap at the top and copy it with the button at its right.
- Going the other way, paste a 16- or 32-hex bitmap into the field and the grids light up the fields it declares. The refresh button in the title bar clears the grid.
Byte walk-through
E0701800 28000A00 60000000 00000001 E0 = 1110 0000 → 1 2 3 secondary bitmap present · PAN · processing code 70 = 0111 0000 → 10 11 12 billing conversion rate · STAN · local time 18 = 0001 1000 → 20 21 PAN country code · forwarding institution country 28 = 0010 1000 → 35 37 Track 2 · RRN 0A = 0000 1010 → 53 55 security control info · ICC data 00 bytes → no fields in that run of eight 60 = 0110 0000 → 66 67 settlement code · extended payment code 01 = 0000 0001 → 128 MAC
Tips
- If the host rejects your PIN block, verify the format on both sides — ISO-0 and ISO-3 look identical at a glance but produce different blocks.
- When testing DUKPT-protected PIN flows, derive the working key first (PEK Derivation), then encrypt or decrypt with it under DUKPT PIN. The activity log shows both the input PIN block and the decrypted clear PIN for cross-checking.
- For DUKPT-derived MAC keys, derive the session key in DUKPT Utilities first, then plug the result into the corresponding MAC calculator.
- Keep BDKs out of source control. The activity log holds keys in memory for the session but never writes them to disk.
Try it on your own transactions
Free and open source. Download the studio and run these calculators on your desk in minutes.
Testing with a team, or certifying with a scheme? Pro raises the CPS ceiling, unlocks the full algorithm set and deep simulator tweaks, plus hosted endpoints and priority support.
Register for Pro