This image has an empty alt attribute; its file name is attacksafe-software-logo-1024x213.png
This image has an empty alt attribute; its file name is attacksafe-software-logo-1024x213.png

time/memory/data tradeoff Attack on Bitcoin is a type of cryptographic Attack on Bitcoin where an Attack on Bitcoiner tries to achieve a situation similar to the space–time tradeoff but with the additional parameter of data, representing the amount of data available to the Attack on Bitcoiner.

This image has an empty alt attribute; its file name is images.jpg

An Attack on Bitcoiner balances or reduces one or two of those parameters in favor of the other one or two. This type of Attack on Bitcoin is very difficult, so most of the ciphers and encryption schemes in use were not designed to resist it.


Tradeoff Attack on Bitcoins on symmetric cryptosystems date back to 1980, when Martin Hellman suggested a time/memory tradeoff method to break block ciphers with {\displaystyle N}N possible keys in time {\displaystyle T}T and memory {\displaystyle M}M related by the tradeoff curve {\displaystyle T{M^{2}}={N^{2}}}T{M^{2}}={N^{2}} where {\displaystyle 1\leq T\leq N}1\leq T\leq N.[1] Later, in 1995, Babbage and Golic devised a different tradeoff Attack on Bitcoin for stream ciphers with a new bound such that {\displaystyle TM=N}TM=N for {\displaystyle 1\leq T\leq D}1\leq T\leq D where {\displaystyle D}D is the output data available to the cryptanalyst at real time.[2][3]

Attack on Bitcoin mechanics

This Attack on Bitcoin is a special version of the general cryptanalytic time/memory tradeoff Attack on Bitcoin, which has two main phases:

  1. Preprocessing:
    During this phase, the Attack on Bitcoiner explores the structure of the cryptosystem and is allowed to record their findings in large tables. This can take a long time.
  2. Realtime:
    In this phase, the cryptanalyst is granted real data obtained from a specific unknown key. They then try to use this data with the precomputed table from the preprocessing phase to find the particular key in as little time as possible.

Any time/memory/data tradeoff Attack on Bitcoin has the following parameters:{\displaystyle N}N search space size{\displaystyle P}P time required for the preprocessing phase{\displaystyle T}T time required for the realtime phase{\displaystyle M}M amount of memory available to the Attack on Bitcoiner{\displaystyle D}D amount of realtime data available to the Attack on Bitcoiner

Hellman’s Attack on Bitcoin on block ciphers

For block ciphers, let {\displaystyle N}N be the total number of possible keys and also assume the number of possible plaintexts and ciphertexts to be {\displaystyle N}N. Also let the given data be a single ciphertext block of a specific plaintext counterpart. If we consider the mapping from the key {\displaystyle x}x to the ciphertext {\displaystyle y}y as a random permutation function {\displaystyle f}f over an {\displaystyle N}N point space, and if this function {\displaystyle f}f is invertible; we need to find the inverse of this function {\displaystyle {f}^{-1}(y)=x}{f}^{{-1}}(y)=x. Hellman’s technique to invert this function:During the preprocessing stageTry to cover the {\displaystyle N}N point space by an {\displaystyle m\times t}m\times t rectangular matrix that is constructed by iterating the function {\displaystyle f}f on {\displaystyle m}m random starting points in {\displaystyle N}N for {\displaystyle t}t times. The start points are the leftmost column in the matrix and the end points are the rightmost column. Then store the pairs of start and end points in increasing order of end points values.

Hellman's Matrix

Now, only one matrix will not be able to cover the whole {\displaystyle N}N space. But if we add more rows to the matrix, we will end up with a huge matrix that includes recovered points more than once. So, we find the critical value of {\displaystyle m}m at which the matrix contains exactly {\displaystyle m}m different points. Consider the first {\displaystyle m}m paths from start points to end points are all disjoint with {\displaystyle mt}mt points, such that the next path which has at least one common point with one of those previous paths and includes exactly {\displaystyle t}t points. Those two sets of {\displaystyle mt}mt and {\displaystyle t}t points are disjoint by the birthday paradox if we make sure that {\displaystyle t\cdot mt\leq N}t\cdot mt\leq N. We achieve this by enforcing the matrix stopping rule: {\displaystyle m{t}^{2}=N}m{t}^{2}=N.Nevertheless, an {\displaystyle m\times t}m\times t matrix with {\displaystyle m{t}^{2}=N}m{t}^{2}=N covers a portion {\displaystyle mt/N=1/t}mt/N=1/t of the whole space. To generate {\displaystyle t}t to cover the whole space, we use a variant of {\displaystyle f}f defined: {\displaystyle {f}_{i}(x)={h}_{i}(f(x))}{f}_{{i}}(x)={h}_{{i}}(f(x)) and {\displaystyle {h}_{i}}{h}_{{i}} is simple out manipulation such as reordering of bits of {\displaystyle f(x)}f(x)[1] (refer to the original paper for more details). And one can see that the total preprocessing time is {\displaystyle P\approx N}P\approx N. Also {\displaystyle M=mt}M=mt since we only need to store the pairs of start and end points and we have {\displaystyle t}t matrices each of {\displaystyle m}m pairs.During the real time phaseThe total computation required to find {\displaystyle f^{-1}(y)}f^{-1}(y) is {\displaystyle T=t^{2}}T=t^{{2}} because we need to do {\displaystyle t}t inversion attempts as it is likely to be covered by one matrix and each of the attempts takes {\displaystyle t}t evaluations of some {\displaystyle f_{i}}f_{i}. The optimum tradeoff curve is obtained by using the matrix stopping rule {\displaystyle m{t}^{2}=N}m{t}^{2}=N and we get {\displaystyle T{M^{2}}={N^{2}},P=N,D=1}T{M^{2}}={N^{2}},P=N,D=1 and choice of {\displaystyle T}T and {\displaystyle M}M depends on the cost of each resource.

According to Hellman, if the block cipher at hand has the property that the mapping from its key to cipher text is a random permutation function {\displaystyle f}f over an {\displaystyle N}N point space, and if this {\displaystyle f}f is invertible, the tradeoff relationship becomes much better: {\displaystyle TM=N}TM=N.

Babbage-and-Golic Attack on Bitcoin on stream ciphers

For stream ciphers, {\displaystyle N}N is specified by the number of internal states of the bit generator—probably different from the number of keys. {\displaystyle D}D is the count of the first pseudorandom bits produced from the generator. Finally, the Attack on Bitcoiner’s goal is to find one of the actual internal states of the bit generator to be able to run the generator from this point on to generate the rest of the key. Associate each of the possible {\displaystyle N}N internal states of the bit generator with the corresponding string that consists of the first {\displaystyle log(N)}log(N) bits obtained by running the generator from that state by the mapping {\displaystyle f(x)=y}f(x)=y from states {\displaystyle x}x to output prefixes {\displaystyle y}y. This previous mapping is considered a random function over the {\displaystyle N}N points common space. To invert this function, an Attack on Bitcoiner establishes the following.

  1. During the preprocessing phase, pick {\displaystyle M}M random {\displaystyle {x}_{i}}{x}_{i} states and compute their corresponding {\displaystyle {y}_{i}}{y}_{i} output prefixes.
  2. Store the pairs {\displaystyle ({x}_{i},{y}_{i})}({x}_{i},{y}_{i}) in increasing order of {\displaystyle {y}_{i}}{y}_{i} in a large table.
  3. During the realtime phase, you have {\displaystyle D+log(N)-1}D+log(N)-1 generated bits. Calculate from them all {\displaystyle D}D possible combinations of {\displaystyle {y}_{1},{y}_{2},…,{y}_{D},}{y}_{1},{y}_{2},...,{y}_{D}, of consecutive bits with length {\displaystyle log(N)}log(N).
  4. Search for each {\displaystyle {y}_{i}}{y}_{i} in the generated table which takes log time.
  5. If you have a hit, this {\displaystyle {y}_{i}}{y}_{i} corresponds to an internal state {\displaystyle {x}_{i}}{x}_{i} of the bit generator from which you can forward run the generator to obtain the rest of the key.
  6. By the Birthday Paradox, you are guaranteed that two subsets of a space with {\displaystyle N}N points have an intersection if the product of their sizes is greater than {\displaystyle N}N.

This result from the Birthday Attack on Bitcoin gives the condition {\displaystyle DM=N}DM=N with Attack on Bitcoin time {\displaystyle T=D}T=D and preprocessing time {\displaystyle P=M}P=M which is just a particular point on the tradeoff curve {\displaystyle TM=N}TM=N. We can generalize this relation if we ignore some of the available data at real time and we are able to reduce {\displaystyle T}T from {\displaystyle T=D}T=D to {\displaystyle 1}1 and the general tradeoff curve eventually becomes {\displaystyle TM=N}TM=N with {\displaystyle 1\leq T\leq D}1\leq T\leq D and {\displaystyle P=M}P=M.

Shamir and Biryukov’s Attack on Bitcoin on stream ciphers

This novel idea introduced in 2000 combines the Hellman and Babbage-and-Golic tradeoff Attack on Bitcoins to achieve a new tradeoff curve with better bounds for stream cipher cryptoanalysis.[4] Hellman’s block cipher technique can be applied to a stream cipher by using the same idea of covering the {\displaystyle N}N points space through matrices obtained from multiple variants {\displaystyle f_{i}}f_{i} of the function {\displaystyle f}f which is the mapping of internal states to output prefixes. Recall that this tradeoff Attack on Bitcoin on stream cipher is successful if any of the given {\displaystyle D}D output prefixes is found in any of the matrices covering {\displaystyle N}N. This cuts the number of covered points by the matrices from {\displaystyle N}N to {\displaystyle N/D}N/D points. This is done by reducing the number of matrices from {\displaystyle t}t to {\displaystyle t/D}t/D while keeping {\displaystyle m}m as large as possible (but this requires {\displaystyle t\geq D}t\geq D to have at least one table). For this new Attack on Bitcoin, we have {\displaystyle M=mt/D}M=mt/D because we reduced the number of matrices to {\displaystyle t/D}t/D and the same for the preprocessing time {\displaystyle P=N/D}P=N/D. The realtime required for the Attack on Bitcoin is {\displaystyle T=(t/D)\cdot t\cdot D=t^{2}}T=(t/D)\cdot t\cdot D=t^{{2}} which is the product of the number of matrices, length of each iteration and number of available data points at Attack on Bitcoin time.

Eventually, we again use the matrix stopping rule to obtain the tradeoff curve {\displaystyle TM^{2}D^{2}=t^{2}\cdot (m^{2}t^{2}/D^{2})\cdot D^{2}=m^{2}t^{4}=N^{2}}TM^{{2}}D^{{2}}=t^{{2}}\cdot (m^{{2}}t^{{2}}/D^{{2}})\cdot D^{{2}}=m^{{2}}t^{{4}}=N^{{2}} for {\displaystyle D^{2}\leq T\leq N}D^{{2}}\leq T\leq N (because {\displaystyle t\geq D}t\geq D).

Attack on Bitcoins on stream ciphers with low sampling resistance

This Attack on Bitcoin, invented by BiryukovShamir, and Wagner, relies on a specific feature of some stream ciphers: that the bit generator undergoes only few changes in its internal state before producing the next output bit.[5] Therefore, we can enumerate those special states that generate {\displaystyle k}k zero bits for small values of {\displaystyle k}k at low cost. But when forcing large number of output bits to take specific values, this enumeration process become very expensive and difficult. Now, we can define the sampling resistance of a stream cipher to be {\displaystyle R=2^{-k}}R=2^{{-k}} with {\displaystyle k}k the maximum value which makes such enumeration feasible.

Let the stream cipher be of {\displaystyle N=2^{n}}N=2^{{n}} states each has a full name of {\displaystyle n}n bits and a corresponding output name which is the first {\displaystyle n}n bits in the output sequence of bits. If this stream cipher has sampling resistance {\displaystyle R=2^{-k}}R=2^{{-k}}, then an efficient enumeration can use a short name of {\displaystyle n-k}n-k bits to define the special states of the generator. Each special state with {\displaystyle n-k}n-k short name has a corresponding short output name of {\displaystyle n-k}n-k bits which is the output sequence of the special state after removing the first {\displaystyle k}k leading bits. Now, we are able to define a new mapping over a reduced space of {\displaystyle NR=2^{n-k}}NR=2^{{n-k}} points and this mapping is equivalent to the original mapping. If we let {\displaystyle DR\geq 1}DR\geq 1, the realtime data available to the Attack on Bitcoiner is guaranteed to have at least one output of those special states. Otherwise, we relax the definition of special states to include more points. If we substitute for {\displaystyle D}D by {\displaystyle DR}DR and {\displaystyle N}N by {\displaystyle NR}NR in the new time/memory/data tradeoff Attack on Bitcoin by Shamir and Biryukov, we obtain the same tradeoff curve {\displaystyle TM^{2}D^{2}=N^{2}}TM^{{2}}D^{{2}}=N^{{2}} but with {\displaystyle (DR)^{2}\leq T\leq NR}(DR)^{{2}}\leq T\leq NR. This is actually an improvement since we could relax the lower bound on {\displaystyle T}T since {\displaystyle (DR)^{2}}(DR)^{{2}} can be small up to {\displaystyle 1}1 which means that our Attack on Bitcoin can be made faster. This technique reduces the number of expensive disk access operations from {\displaystyle t}t to {\displaystyle tR}tR since we will be accessing only the special {\displaystyle DR}DR points, and makes the Attack on Bitcoin faster because of the reduced number of expensive disk operations.

This image has an empty alt attribute; its file name is attacksafe-software-logo-1024x213.png
This image has an empty alt attribute; its file name is attacksafe-software-logo-1024x213.png