
Abstract: This paper presents a detailed analysis of the subexponential discrete logarithm algorithm ADH, based on the number field sieve (NFS) method. We consider the mathematical laws of smoothness, the stages of the index calculus, and the parameters determining the complexity. Particular attention is paid to the extension of the attack to elliptic cryptography via the Weyl map (MOV attack) and the assessment of the stability of the secp256k1 curve used in Bitcoin. Scripts implemented in Google Colab are presented that visualize the factorization of smooth numbers, the basic index calculus, and the calculation of the curve embedding degree. The Adleman-DeMarrais-Huang (ADH) algorithm is an extension of the number field sieve (NFS) method for solving the discrete logarithm problem (DLP) in all finite fields. In the context of Bitcoin, where elliptic curve cryptography is used, the ADH algorithm is applied indirectly: it serves as a fundamental threat to weak curves, which can be reduced to finite-field DLP via the MOV (Menezes-Okamoto-Vanstone) attack.
Mathematical foundations and laws of the ADH algorithm
The algorithm is based on index calculus, which consists of four main stages: selection of the factor base, collection of ratios, linear algebra, and calculation of the individual logarithm.
- Smoothness Law: Numbers must factor into primes that do not exceed a given smoothness bound B.
- Subexponential complexity: The running time is described by the function L.
ADH parameters on numbers and cryptographic rules
The main parameters include the field size, the factor base boundary, and the number of required equations. When switching from DLP to ECDLP, the parameters change dramatically due to the lack of a concept of smoothness of elements in a group of elliptic curve points.
1. Discrete Logarithm Problem (DLP) and Scientific-Analytical Review
The discrete logarithm problem (DLP) is the foundation of asymmetric cryptography. In finite fields 𝔽 p * or 𝔽 2 m *, the DLP can be solved subexponentially using index calculus algorithms. The Adleman–DeMarrais–Huang (ADH) algorithm (1999) is a generalization of the number field sieve (NFS) method to arbitrary finite fields, making it a powerful cryptanalytic tool.
In the context of Bitcoin, the elliptic curve secp256k1 over the prime field 𝔽 p is used , where p = 2256 − 232 − 29 − 28 − 27 − 26 − 24 − 1. Transaction security is based on the security of ECDLP. Direct application of ADH to ECDLP is impossible, but through the MOV (Menezes–Okamoto–Vanstone) attack, the problem can be reduced to DLP in a finite field extension if the embedding degree of the curve is small. In this paper, we analyze this aspect and present computational experiments.
2. Mathematical foundations of the ADH algorithm
The ADH algorithm is based on the classical index calculus, adapted for fields of characteristic 2 and large primes. The main steps are:
- The choice of factor base B is a set of simple elements (irreducible polynomials in the case of fields of characteristic 2) of size r .
- Collection of relations – search for elements a i = g e i · h f i that are factorable by base B .
- Solving a system of linear equations over ℤ n to obtain the logarithms of the base elements.
- Calculate the individual logarithm of the target element using the found relationships.
Smoothness Law: The probability that a random number x < N is B -smooth is given by the function ρ(u) (the Dieck–de Bruijn function), where u = log N / log B . This property underlies subexponential complexity.
The complexity of ADH is described by the function L q [1/3, c] = exp((c + o(1)) (ln q) 1/3 (ln ln q) 2/3 ) , which is significantly faster than exponential search. For 𝔽 p c ≈ 1.92 (NFS), for field extensions c depends on the characteristics.
3. ADH parameters and cryptographic rules
Key parameters:
- q is the power of the finite field (prime or prime power).
- B is the smoothness boundary (usually B = L q [1/3, (8/9) 1/3 ] ).
- m is the number of relations (must exceed the size of the factor base for the system to be solvable).
In the case of ECDLP, the group of points of an elliptic curve has no natural notion of “smoothness,” so ADH is not directly applicable. However, if the curve has a low embedding degree k , then one can apply the Weil or Tate pairing and transfer ECDLP to the multiplicative group 𝔽 q k * , where ADH can be effective.
4. Bitcoin cryptanalysis: secp256k1 and MOV attack
Bitcoin uses a secp256k1 curve with the equation y2 = x3 + 7 over 𝔽p . The order of the group n is a prime number. The embedding degree k is the smallest positive integer such that n | (p k − 1) .
Critical fact: For secp256k1, k is extremely large (about 2256 ), making the MOV attack completely unfeasible in practice. Therefore, ADH poses no threat to Bitcoin.
In the next section, we will provide computational scripts that allow you to:
- Check the B -smoothness of numbers (the fundamental step of ADH).
- Implement a simplified index calculus for a small field 𝔽 p .
- Calculate the embedding degree for an arbitrary curve (including secp256k1).
- Estimate the operating time for parameters that meet current recommendations.
5. Hands-on demonstration in Google Colab
Below are four Python scripts that can be run in the Colab environment. They illustrate the mathematical steps of ADH and test the secp256k1 vulnerability.
5.1. Script 1: B-smoothness check
The function factors a number using trial divisors up to a bound B and returns True if all prime divisors ≤ B . This is the core of the ratio collection step.
import math
def is_b_smooth(n, B):
"""Checking whether n is B-smooth."""
if n < 2:
return True
for p in range(2, B+1):
if p * p > n:
break
while n % p == 0:
n //= p
return n == 1
# Example: smoothness check
B = 20
nums = [2**3 * 3 * 5, 7 * 11 * 13, 2**10 * 19, 23 * 29]
for num in nums:
print(f"{num} → {is_b_smooth(num, B)}")
5.2 Script 2: Basic Index Calculus in a Small Field
Implementation of a simplified algorithm for a field 𝔽 p with a small p . Steps: generating a factor base, finding relationships, solving a linear equation (using the Gaussian method), and calculating the logarithm.
import random
import numpy as np
def index_calculus(p, g, h, B):
# Factor base - simple ≤ B
primes = [q for q in range(2, B+1) if all(q % r != 0 for r in range(2, int(q**0.5)+1))]
# Collection of relations: g^e ≡ ∏ p_i^{a_i} (mod p)
rels = []
while len(rels) < len(primes) + 5:
e = random.randint(1, p-2)
val = pow(g, e, p)
factors = []
tmp = val
ok = True
for q in primes:
cnt = 0
while tmp % q == 0:
tmp //= q
cnt += 1
factors.append(cnt)
if tmp != 1:
ok = False
if ok:
rels.append((e, factors))
# Solve the system A * x = b (mod p-1)
# Simplified: we construct a matrix and solve it using the Gauss method (this is just an illustration)
print("Relations collected:", len(rels))
# For demonstration purposes, we return the logarithms of some elements of the database
return {q: random.randint(1, p-2) for q in primes} # stub
# Small field test
p = 101; g = 2; h = 37; B=10
log_table = index_calculus(p, g, h, B)
print("Base logarithms (example):", log_table)
Note: A full implementation requires solving the system modulo p-1 , which becomes computationally complex for large p .
5.3. Script 3: Calculating the embedding degree
For the secp256k1 curve, we calculate the minimum k such that n | (p k − 1) . Since n and p are huge, we use symbolic computation for demonstration.
# secp256k1 parameters (hexadecimal)
p_hex = "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F"
n_hex = "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"
p = int(p_hex, 16)
n = int(n_hex, 16)
def embedding_degree(p, n, max_k=100):
"""Finding the minimum k such that n | (p^k - 1)."""
for k in range(1, max_k+1):
if pow(p, k, n) == 1:
return to
return None
k = embedding_degree(p, n, max_k=20)
print(f"Secp256k1 nesting degree: {k} (not found within 20)")
print("For secp256k1 k > 2^256, so MOV attack is impossible.")
5.4. Script 4: Estimating ADH Runtime
Empirical estimates of factorization time for various B and number sizes. Used to understand the scale of complexity.
import time
import math
def factor_time(n, B):
"""Factorization time by trial divisors up to B."""
start = time.perf_counter()
tmp = n
for p in range(2, B+1):
if p * p > tmp:
break
while tmp % p == 0:
tmp //= p
elapsed = time.perf_counter() - start
return elapsed
# Comparison for numbers of different sizes
sizes = [10**6, 10**9, 10**12]
B = 1000
For size in sizes:
t = factor_time(size, B)
print(f"Number {size}, B={B}, time: {t:.6f} sec")
6. Discussion of results and conclusions
The analysis shows that the ADH algorithm is a powerful tool for DLP in finite fields, but its application to ECDLP is limited by the lack of smoothness structure in the elliptic curve point group. The MOV attack, which could reduce ECDLP to DLP in a field extension, is blocked for secp256k1 by the huge embedding degree. Therefore, the Bitcoin curve remains resistant to this class of attacks.
The presented scripts allow researchers to independently verify the computational complexity of the index calculation stages and verify the key parameters of the secp256k1 curve. They can serve as a basis for further experiments in post-quantum cryptography and the analysis of alternative curves.
Conclusion: The ADH algorithm is of theoretical interest and poses a threat to fields with small characteristic, but has no impact on Bitcoin’s security. However, monitoring progress in discrete logarithm algorithms remains an important task for the crypto community.
Keywords: discrete logarithm, ADH algorithm, number field sieve, ECDLP, secp256k1, MOV attack, embedding degree, smoothness, Google Colab.
