跳到主要内容
uencoder

IV (Initialization Vector)

IV(初始化向量)是分组密码模式中引入随机性的输入,使相同明文在不同加密中产生不同密文。

用途

防止相同明文块模式泄露,提供语义安全(semantic security)。

机制

IV 长度通常等于分组大小(如 AES 用 128 位 IV)。CBC 要求 IV 不可预测(随机);CTR/GCM 要求 IV 唯一(可用计数器)。IV 无需保密,随密文传输。GCM 的 IV 常称 nonce。

用例

  • AES-CBC 随机 IV
  • AES-GCM 唯一 nonce
  • 磁盘加密 IV 存储
  • 密文标识与去重

示例

  • 输入
    AES-CBC IV=random 128 bits
    输出
    different result on every encryption

    The IV is transmitted with the ciphertext

常见错误

A fixed or predictable IV enables chosen-plaintext attacks
Use a random IV for CBC and a unique nonce for CTR/GCM

相关词条

相关工具

参考链接