RSA
Rivest-Shamir-Adleman
An asymmetric cryptographic algorithm using public/private key pairs for encryption and digital signatures.
Technical Detail
RSA operates on 128-bit blocks with key sizes of 128, 192, or 256 bits. It performs 10, 12, or 14 rounds of substitution-permutation transformations respectively. Block cipher modes matter: ECB (insecure, reveals patterns), CBC (chained blocks, requires IV), CTR (parallelizable, stream-like), and GCM (authenticated encryption, provides both confidentiality and integrity). AES-256-GCM is the recommended mode for new applications. Modern CPUs include AES-NI instructions for hardware-accelerated encryption.
Example
```javascript
// AES-256-GCM encryption (Web Crypto API)
const key = await crypto.subtle.generateKey(
{ name: 'AES-GCM', length: 256 }, true, ['encrypt', 'decrypt']
);
const iv = crypto.getRandomValues(new Uint8Array(12));
const ciphertext = await crypto.subtle.encrypt(
{ name: 'AES-GCM', iv },
key,
new TextEncoder().encode('secret message')
);
```