NodeCrypto Help

TDES Encrypt

Category: Symmetric Ciphers ยท Node Type ID: symmetric-tdes-encrypt

Triple-DES (112 or 168-bit Key) Encryption (NIST SP 800-67)

Overview

Encrypts data using the Triple Data Encryption Algorithm (TDES / 3DES) as standardized in NIST SP 800-67 and ISO/IEC 18033-3. TDES applies the 64-bit (8-byte) DES block cipher three times per block in Encrypt-Decrypt-Encrypt (EDE) order ($E_{K_3}(D_{K_2}(E_{K_1}(P)))$).

Accepts either a 16-byte key (2-Key TDES / 112-bit effective security, where $K_3 = K_1$) or a 24-byte key (3-Key TDES / 168-bit effective security) and supports CBC, ECB, CTR, CFB, and OFB modes over 8-byte blocks.

When to Use

Parameter Configuration

Parameter (ID)Type & DefaultVisibility ConditionDescription & Options
Cipher Mode
mode
select
Default: ECB
Always visible Selects the 64-bit block cipher operating mode: CBC, ECB, CTR, CFB, or OFB. Hides the IV port when set to ECB. See Block Cipher Modes for full details.
  • ECB: ECB (Electronic Codebook)
  • CBC: CBC (Cipher Block Chaining)
Padding
padding
select
Default: None
Always visible 8-byte block padding scheme applied in ECB and CBC modes. Hidden in stream modes (CTR, CFB, OFB). See Padding Schemes for full details.
Unify Errors
errorUnify
boolean
Default: false
Supports Variable Reference ($var: bool)
Always visible Replaces built-in errors with a single custom error code/message when enabled.
Unified Error Code
errorUnifyCode
text
Default: "" (empty)
Supports Variable Reference ($var: string)
When errorUnify is true Custom error code when Unify Errors is enabled.
Unified Error Message
errorUnifyMessage
text
Default: "" (empty)
Supports Variable Reference ($var: string)
When errorUnify is true Custom error message when Unify Errors is enabled.

Port I/O Specification

See Ports & Connections for general wiring rules, data type colors, and dynamic port creation.

Input Ports

Port Nature: Fixed Input Ports (3 total; conditionally visible ports depend on parameter settings as shown below).

Port NamePort IDData TypeRequiredVisibility ConditionDescription
Key key Bytes (16/24B) Required Always visible TDES key: 16 bytes (2-key EDE2, 112-bit) or 24 bytes (3-key EDE3, 168-bit).
Plaintext plaintext Bytes Required Always visible Plaintext bytes (Uint8Array) to encrypt. Must be a multiple of 8 bytes when Mode is ECB/CBC and Padding = None.
IV iv Bytes (8B) Optional When mode is CBC 8-byte initialization vector or initial counter block. Only visible in CBC, CTR, CFB, and OFB modes. Defaults to 8 zero bytes if unconnected.

Output Ports

Port Nature: Fixed Output Ports (1 total).

Port NamePort IDData TypeVisibility ConditionDescription
Ciphertext ciphertext Bytes Always visible Encrypted output bytes (Uint8Array).

Error Cases

When any of the following conditions occurs at runtime, this node transitions to an ERROR state and downstream nodes connected to its outputs do not execute. Enabling Unify Errors (errorUnify) replaces all error codes below with your configured unified error code and message.

Error CodeDefault Engine MessageTrigger Condition
INVALID_KEY_LENGTH Invalid key length Raised when Key is neither 16 bytes nor 24 bytes.
PLAINTEXT_NOT_BLOCK_ALIGNED In NoPad mode the plaintext length must be a multiple of the block size Raised in ECB or CBC mode when Padding = None and Plaintext length is not a multiple of 8 bytes.

Examples

Encrypting an 8-Byte EMV Cryptogram Block with 2-Key 3DES

Encrypt a 16-byte payload in CBC mode with a 16-byte 3DES key and zero IV.

  1. Set Cipher Mode to CBC and Padding to None (or ISO7816).
  2. Connect a 16-byte key to Key and your 16-byte payload to Plaintext.