跳到主要内容
uencoder

计算 modular exponentiation efficiently

计算 base^exponent mod modulus efficiently using the square-and-multiply algorithm. Essential for cryptography.

  1. 1

    Modular exponentiation computes 进制^exp mod m 无 calculating enormous 进制^exp 第一. square-and-multiply algorithm 过程每个位 的 exponent: square 结果为 每个位, multiply 通过进制如果位 是 1, take mod 在每个步骤. 此是 O(记录 exp) 而非 O(exp) — 关键为 crypto where exp 有 2048+ bits.

  2. 2
    模幂运算计算器 →

    计算 base^exp mod m directly. Enter base, exponent, and modulus. The tool uses the efficient algorithm — even with a 2048-bit exponent, it completes instantly. This is the foundation of RSA, Diffie-Hellman, and other cryptographic operations.

  3. 3
    高精度计算器 →

    Verify 结果具有小 numbers. 为示例, 3^5 mod 7 = 243 mod 7 = 5. modular exponentiation tool 应该 give 相同结果. 此 sanity 检查 verifies algorithm 是工作正确.

常见问题

为什么是 naive exponentiation impractical 为 crypto?
RSA 我们 exponents 具有 2048+ bits. 2^2048 是数字具有 617 digits — computing 它 directly 会 require 更多内存 than exists 开 Earth. Modular exponentiation keeps 中级结果小 (总是 < m) 通过 taking mod 在每个步骤, making 它可行.
什么是 square-and-multiply algorithm?
处理 exponent 位通过位. 开始具有结果 = 1. 为每个位 (MSB 到 LSB): 结果 = 结果^2 mod m (square); 如果位 是 1, 结果 = 结果 * 进制 mod m (multiply). 此过程每个位 具有在 最多 2 multiplications — O(记录 exp) 总计.

相关工具