Cryptography tools

Calculate CVV / CVC

Visa / MC
Compute and verify CVV/CVC, iCVV, CVV2/CVC2, and dCVV for Visa and Mastercard.

Card Verification Value

CVV

PAN, expiry, CVK/MDK, and type-specific fields below.

Used for CVV/CVC only.

Used for dCVV only.

ready
  How it works

Shared CVV algorithm

Visa CVV and Mastercard CVC use the same DES-based scheme. What changes is the input block (especially the 3-digit service-code field).

  1. Use a 2-part 16-byte CVK/MDK (32 hex)
  2. Build Data = PAN + expiry (YYMM) + 3-digit field (+ ATC for dCVV)
  3. Pad with zeroes on the right to 32 hex digits
  4. DES-encrypt block 1 with key A
  5. XOR with block 2
  6. DES-encrypt with key A → decrypt with key B → encrypt with key A
  7. Decimalize: keep digits; map A–F → 0–5; first 3 digits = result
Data = (PAN + YYMM + SVC [+ ATC]) || 0… → 32 chars
T1   = DES(Data[0..15], KA)
T2   = DES(T1 ⊕ Data[16..31], KA)
T3   = DES⁻¹(T2, KB)
T4   = DES(T3, KA)
CVV  = decimalize(T4)[0..2]

CVV / CVC

track / magstripe

Classic Card Verification Value (Visa) / Card Validation Code (Mastercard). Encoded on the magnetic stripe; used for card-present / track verification.

  • Input: PAN + expiry (YYMM) + real service code (e.g. 101, 201)
  • Service code: taken from track 2; enters the 3-digit SVC field as-is
  • Output: 3 digits, compared to the CVV/CVC on the stripe
concat = PAN + YYMM + SVC + 0…
// SVC = value you enter (e.g. 101)

iCVV

chip / ICC

iCVV (iCVV / “chip CVV”) protects chip-generated track-equivalent data. Same algorithm as CVV, but the service-code field is forced to 999 so a magstripe CVV cannot be reused from a chip dump.

  • Input: PAN + expiry + SVC fixed to 999
  • Your SVC field: ignored for this mode (overridden in the calculator)
  • Use: EMV / contactless track data verification
concat = PAN + YYMM + 999 + 0…
// SVC always 999 for iCVV

CVV2 / CVC2

card-not-present

Printed on the card back (or front for Amex-style layouts). Used for e-commerce / MOTO; never stored on the magnetic stripe.

  • Input: PAN + expiry + SVC fixed to 000
  • Your SVC field: ignored for this mode
  • Note: Visa often uses MMYY order on the physical card print; this tool uses YYMM in the crypto block (issuer convention). Match your scheme’s expiry order.
concat = PAN + YYMM + 000 + 0…
// SVC always 000 for CVV2/CVC2

dCVV

dynamic / ATC

Dynamic CVV changes with the Application Transaction Counter (ATC). Used in some contactless / dynamic-CVV card products so a captured code cannot be replayed forever.

  • Input: PAN + expiry + SVC 000 + ATC (then pad)
  • ATC: required — enter the current counter (padded in the tool)
  • Output: still 3 digits, but tied to that ATC
concat = PAN + YYMM + 000 + ATC + 0…
// truncated to 32 chars before DES
  Quick reference
Type Where used SVC in block Extra input
CVV / CVC Magstripe / track 1–2 Real service code —
iCVV Chip track equivalent 999 (fixed) —
CVV2 / CVC2 Printed / CNP 000 (fixed) —
dCVV Dynamic / contactless 000 (fixed) ATC
  Related

Recent Articles on Iso8583