The algorithm works in the final field {\ displaystyle GF (p ^ {6})}
. Consider the order group {\ displaystyle p ^ {2} -p + 1}
, and its subgroup of order q , where p is a prime, such that another sufficiently large prime q is a divisor {\ displaystyle p ^ {2} -p + 1}
. A group of order q is called an XTR-subgroup. This cyclic group {\ displaystyle \ langle g \ rangle}
is a subgroup {\ displaystyle GF (p ^ {6}) ^ {*}}
and has a generator g .
Arithmetic operations in {\ displaystyle GF (p ^ {2})} 
Let p be a prime such that p ≡ 2 mod 3 and p 2 - p + 1 be divided by a sufficiently large prime q . Since p 2 ≡ 1 mod 3 , p generates {\ displaystyle (\ mathbb {Z} / 3 \ mathbb {Z}) ^ {*}}
. So the circular polynomial {\ displaystyle \ Phi _ {3} (x) = x ^ {2} + x + 1}
is irreducible in {\ displaystyle GF (p)}
. Hence the roots {\ displaystyle \ alpha}
and {\ displaystyle \ alpha ^ {p}}
form the optimal normal basis {\ displaystyle GF (p ^ {2})}
over {\ displaystyle GF (p)}
and
- {\ displaystyle GF (p ^ {2}) \ cong \ {x_ {1} \ alpha + x_ {2} \ alpha ^ {p}: x_ {1}, x_ {2} \ in GF (p) \} .}

Given p ≡ 2 mod 3 :
- {\ displaystyle GF (p ^ {2}) \ cong \ {y_ {1} \ alpha + y_ {2} \ alpha ^ {2}: \ alpha ^ {2} + \ alpha + 1 = 0, y_ {1 }, y_ {2} \ in GF (p) \}.}

Thus, the cost of arithmetic operations is as follows:
- Calculation of x p does not require multiplication
- Computing x 2 requires two multiplication operations in {\ displaystyle GF (p)}

- Computing xy requires three multiplication operations in {\ displaystyle GF (p)}

- Xz-yz calculation p requires four multiplication operations in {\ displaystyle GF (p)}
.: [1]
Using traces in {\ displaystyle GF (p ^ {2})}
Elements associated with {\ displaystyle h \ in GF (p ^ {6})} at {\ displaystyle GF (p ^ {2})} are: myself {\ displaystyle h, h ^ {p ^ {2}}} and {\ displaystyle h ^ {p ^ {4}}} , and their sum is a trace {\ displaystyle h} .
- {\ displaystyle Tr (h) = h + h ^ {p ^ {2}} + h ^ {p ^ {4}}.}
Besides:
- {\ displaystyle {\ begin {aligned} Tr (h) ^ {p ^ {2}} & = h ^ {p ^ {2}} + h ^ {p ^ {4}} + h ^ {p ^ {6 }} \\ & = h + h ^ {p ^ {2}} + h ^ {p ^ {4}} \\ & = Tr (h) \ end {aligned}}}
Consider a generator {\ displaystyle g} XTR order groups {\ displaystyle q} where {\ displaystyle q} - Prime number. As {\ displaystyle \ langle g \ rangle} - subgroup of the order group {\ displaystyle p ^ {2} -p + 1} then {\ displaystyle q \ mid p ^ {2} -p + 1} . Besides,
- {\ displaystyle p ^ {2} = p-1}
and
- {\ displaystyle p ^ {4} = (p-1) ^ {2} = p ^ {2} -2p + 1 = -p} .
In this way,
- {\ displaystyle {\ begin {aligned} Tr (g) & = g + g ^ {p ^ {2}} + g ^ {p ^ {4}} \\ & = g + g ^ {p-1} + g ^ {- p}. \ end {aligned}}}
We also note that conjugate to the element {\ displaystyle g} is an {\ displaystyle 1} , i.e, {\ displaystyle g} has a norm of 1. A key feature of XTR is that the minimum polynomial {\ displaystyle g} at {\ displaystyle GF (p ^ {2})}
- {\ displaystyle (xg) \! \ (xg ^ {p-1}) (xg ^ {- p})}
simplified to
- {\ displaystyle x ^ {3} -Tr (g) \! \ x ^ {2} + Tr (g) ^ {p} x-1}
In other words, conjugate to {\ displaystyle g} elements like the roots of a minimal polynomial in {\ displaystyle GF (p ^ {2})} are completely determined by the trace {\ displaystyle g} . Similar reasoning is true for any degree {\ displaystyle g} :
- {\ displaystyle x ^ {3} -Tr (g ^ {n}) \! \ x ^ {2} + Tr (g ^ {n}) ^ {p} x-1}
- this polynomial is determined by the trace {\ displaystyle Tr (g ^ {n})} .
The idea of the algorithm is to replace {\ displaystyle g ^ {n} \ in GF (p ^ {6})} on {\ displaystyle Tr (g ^ {n}) \ in GF (p ^ {2})} that is, calculate {\ displaystyle Tr (g ^ {n})} by {\ displaystyle Tr (g)} instead {\ displaystyle g ^ {n}} by {\ displaystyle g} However, for the method to be effective, a way is needed {\ displaystyle Tr (g ^ {n})} according to available {\ displaystyle Tr (g)} .
Fast calculation algorithm {\ displaystyle Tr (g ^ {n})} by {\ displaystyle Tr (g)} [2]
Definition: For each {\ displaystyle c} {\ displaystyle GF (p ^ {2})} define:
- {\ displaystyle F (c, X) = X ^ {3} -cX ^ {2} + c ^ {p} X-1 \ in GF (p ^ {2}) [X].}
Definition: Let {\ displaystyle h_ {0}, \! \ h_ {1}, h_ {2}} - roots {\ displaystyle F (c, X)} at {\ displaystyle GF (p ^ {6})} , but {\ displaystyle n \ in \ mathbb {Z}} . Denote:
- {\ displaystyle c_ {n} = h_ {0} ^ {n} + h_ {1} ^ {n} + h_ {2} ^ {n}.}
The properties {\ displaystyle c_ {n}} and {\ displaystyle F (c, X)} :
- {\ displaystyle c = c_ {1}}
- {\ displaystyle c _ {- n} = c_ {np} = c_ {n} ^ {p}}
- {\ displaystyle c_ {n} \ in GF (p ^ {2})} for {\ displaystyle n \ in \ mathbb {Z}}
- {\ displaystyle c_ {u + v} = c_ {u} c_ {v} -c_ {v} ^ {p} c_ {uv} + c_ {u-2v}} for {\ displaystyle u, v \ in \ mathbb {Z}}
- Or all {\ displaystyle h_ {j}} have a divisor order {\ displaystyle p ^ {2} -p + 1} and {\ displaystyle> 3} or all {\ displaystyle h_ {j}} - in field {\ displaystyle GF (p ^ {2})} . In particular, {\ displaystyle F (c, X)} - irreducible if and only if its roots have an order that is a divisor {\ displaystyle p ^ {2} -p + 1} and {\ displaystyle> 3} .
- {\ displaystyle F (c, X)} we give in the field {\ displaystyle GF (p ^ {2})} if and only if {\ displaystyle c_ {p + 1} \ in GF (p)}
Statement: May they be given {\ displaystyle c, \! \ c_ {n-1}, c_ {n}, c_ {n + 1}} .
- Calculation {\ displaystyle c_ {2n} = c_ {n} ^ {2} -2c_ {n} ^ {p}} requires two product operations in the field {\ displaystyle GF (p)} .
- Calculation {\ displaystyle c_ {n + 2} = c_ {n + 1} \ cdot cc ^ {p} \ cdot c_ {n} + c_ {n-1}} requires four product operations in the field {\ displaystyle GF (p)} .
- Calculation {\ displaystyle c_ {2n-1} = c_ {n-1} \ cdot c_ {n} -c ^ {p} \ cdot c_ {n} ^ {p} + c_ {n + 1} ^ {p}} requires four product operations in the field {\ displaystyle GF (p)} .
- Calculation {\ displaystyle c_ {2n + 1} = c_ {n + 1} \ cdot c_ {n} -c \ cdot c_ {n} ^ {p} + c_ {n-1} ^ {p}} requires four product operations in the field {\ displaystyle GF (p)} .
Definition: Let {\ displaystyle S_ {n} (c) = (c_ {n-1}, c_ {n}, c_ {n + 1}) \ in GF (p ^ {2}) ^ {3}} .
Algorithm for calculating {\ displaystyle S_ {n} (c)} given {\ displaystyle n} and {\ displaystyle c}
- At {\ displaystyle n <0} the algorithm is applied to {\ displaystyle -n} and {\ displaystyle c} , then property 2 is used to obtain the final result
- At {\ displaystyle n = 0} , {\ displaystyle S_ {0} (c) \! \ = (c ^ {p}, 3, c)} .
- At {\ displaystyle n = 1} , {\ displaystyle S_ {1} (c) \! \ = (3, c, c ^ {2} -2c ^ {p})} .
- At {\ displaystyle n = 2} , we will use expressions for {\ displaystyle c_ {n + 2} = c_ {n + 1} \ cdot cc ^ {p} \ cdot c_ {n} + c_ {n-1}} and {\ displaystyle S_ {1} (c)} to find {\ displaystyle c_ {3}} and correspondingly, {\ displaystyle S_ {2} (c)} .
- At {\ displaystyle n> 2} to calculate {\ displaystyle S_ {n} (c)} introduce
- {\ displaystyle {\ bar {S}} _ {i} (c) = S_ {2i + 1} (c)}
- and {\ displaystyle {\ bar {m}} = n} if not {\ displaystyle n} odd and {\ displaystyle {\ bar {m}} = n-1} if even. Put {\ displaystyle {\ bar {m}} = 2m + 1, k = 1} and find {\ displaystyle {\ bar {S}} _ {k} (c) = S_ {3} (c)} using the Statement, and {\ displaystyle S_ {2} (c)} . Let, further,
- {\ displaystyle m = \ sum _ {j = 0} ^ {r} m_ {j} 2 ^ {j}}
- Where {\ displaystyle m_ {j} \ in {0,1}} and {\ displaystyle m_ {r} = 1} . For {\ displaystyle j = r-1, r-2, ..., 0} sequentially perform the following:
- At {\ displaystyle m_ {j} = 0} use {\ displaystyle {\ bar {S}} _ {k} (c)} to find {\ displaystyle {\ bar {S}} _ {2k} (c)} .
- At {\ displaystyle m_ {j} = 1} use {\ displaystyle {\ bar {S}} _ {k} (c)} to find {\ displaystyle {\ bar {S}} _ {2k + 1} (c)} .
- Replace {\ displaystyle k} on {\ displaystyle 2k + m_ {j}} .
Upon completion of the iterations, {\ displaystyle k = m} , but {\ displaystyle S _ {\ bar {m}} (c) = {\ bar {S}} _ {m} (c)} . If n is even, we use {\ displaystyle S _ {\ bar {m}} (c)} to find {\ displaystyle {\ bar {S}} _ {m + 1} (c)} .
Select a field and subgroup size
To take advantage of the presentation of the elements of groups in the form of their traces and to ensure sufficient data security, you need to find simple {\ displaystyle p} and {\ displaystyle q} where {\ displaystyle p} - field characteristic {\ displaystyle GF (p ^ {6})} , and {\ displaystyle p \ equiv 2 \ {\ text {mod}} \ 3} , but {\ displaystyle q} - subgroup size and divisor {\ displaystyle p ^ {2} -p + 1} . Denote by {\ displaystyle P} and {\ displaystyle Q} sizes {\ displaystyle p} and {\ displaystyle q} in bits. To achieve the security level that, for example, provides RSA with a key length of 1024 bits, you must select {\ displaystyle P} such that {\ displaystyle 6P> 1024} , i.e {\ displaystyle P \ approx 170} but {\ displaystyle Q} maybe around 160. The first algorithm to calculate such simple {\ displaystyle p} and {\ displaystyle q} - Algorithm A.
Algorithm A
- Will find {\ displaystyle r \ in \ mathbb {Z}} such that the number {\ displaystyle q = r ^ {2} -r + 1} Is a prime number in length {\ displaystyle Q} bit.
- Will find {\ displaystyle k \ in \ mathbb {Z}} such that the number {\ displaystyle p = r + k \ cdot q} - simple length {\ displaystyle P} bit as well {\ displaystyle p \ equiv 2 \ {\ text {mod}} \ 3} .
- Correctness of Algorithm A:
- It is only necessary to verify that {\ displaystyle q \ mid p ^ {2} -p + 1} , since all the remaining properties are obviously satisfied due to the specifics of the choice {\ displaystyle p} and {\ displaystyle q} .
- It is easy to see that {\ displaystyle p ^ {2} -p + 1 = r ^ {2} + 2rkq + k ^ {2} q ^ {2} -r-kq + 1 = r ^ {2} -r + 1 + q ( 2rk + k ^ {2} qk) = q (1 + 2rk + k ^ {2} qk)} means {\ displaystyle q \ mid p ^ {2} -p + 1} .
Algorithm A is very fast, but it can be unsafe, as it is vulnerable to attack using a sieve of a number field .
The slower Algorithm B. has been saved from this drawback.
Algorithm B
- Choose a prime {\ displaystyle q} in length {\ displaystyle Q} bit such that {\ displaystyle q \ equiv 7 \ {\ text {mod}} \ 12} .
- Find the roots {\ displaystyle r_ {1}} and {\ displaystyle r_ {2}} {\ displaystyle X ^ {2} -X + 1 \ {\ text {mod}} \ q} .
- Will find {\ displaystyle k \ in \ mathbb {Z}} such that {\ displaystyle p = r_ {i} + k \ cdot q} , {\ displaystyle p} - simple {\ displaystyle P} bit number and at the same time {\ displaystyle p \ equiv 2 \ {\ text {mod}} \ 3} for {\ displaystyle i \ in \ {1,2 \}}
- Correctness of Algorithm B:
- As soon as we choose {\ displaystyle q \ equiv 7 \ {\ text {mod}} \ 12} , the condition is automatically satisfied {\ displaystyle q \ equiv 1 \ {\ text {mod}} \ 3} (As {\ displaystyle 7 \ equiv 1 \ {\ text {mod}} \ 3} and {\ displaystyle 3 \ mid 12} ) From this statement and the quadratic law of reciprocity it follows that the roots {\ displaystyle r_ {1}} and {\ displaystyle r_ {2}} exists.
- To verify that {\ displaystyle q \ mid p ^ {2} -p + 1} consider again {\ displaystyle p ^ {2} -p + 1} for {\ displaystyle r_ {i} \ in \ {1,2 \}} and note that {\ displaystyle p ^ {2} -p + 1 = r_ {i} ^ {2} + 2r_ {i} kq + k ^ {2} q ^ {2} -r_ {i} -kq + 1 = r_ { i} ^ {2} -r_ {i} + 1 + q (2rk + k ^ {2} qk) = q (2rk + k ^ {2} qk)} . Means {\ displaystyle r_ {1}} and {\ displaystyle r_ {2}} roots {\ displaystyle X ^ {2} -X + 1} and therefore {\ displaystyle q \ mid p ^ {2} -p + 1} .
Subgroup Selection
In the previous section we found the sizes {\ displaystyle p} and {\ displaystyle q} final field {\ displaystyle GF (p ^ {6})} and multiplicative subgroup in {\ displaystyle GF (p ^ {6}) ^ {*}} . Now you should find a subgroup {\ displaystyle \ langle g \ rangle} at {\ displaystyle GF \! \ (p ^ {6}) ^ {*}} for some {\ displaystyle g \ in GF (p ^ {6})} such that {\ displaystyle \ mid \! \!! langle g \ rangle \! \!! \ mid = q} . However, it is not necessary to look for an explicit element. {\ displaystyle g \ in GF (p ^ {6})} , just find the element {\ displaystyle c \ in GF (p ^ {2})} such that {\ displaystyle c = Tr (g)} for item {\ displaystyle g \ in GF (p ^ {6})} of order {\ displaystyle q} . But with this {\ displaystyle Tr (g)} generator {\ displaystyle g} XTR groups can be found by finding the root {\ displaystyle F (Tr (g), \ X)} . To find it {\ displaystyle c} , consider property 5 {\ displaystyle F (c, \ X)} . Finding such {\ displaystyle c} should check whether it is really order {\ displaystyle q} , however, we must first choose c \ in GF (p²) such that F (c, \ X) is irreducible. The simplest approach is to choose {\ displaystyle c \ in GF (p ^ {2}) \ backslash GF (p)} randomly.
Statement: For a randomly selected {\ displaystyle c \ in GF (p ^ {2})} the probability that {\ displaystyle F (c, \ X) = X ^ {3} -cX ^ {2} + c ^ {p} X-1 \ in GF (p ^ {2}) [X]} - irreducible, more than 1/3.
Basic search algorithm {\ displaystyle Tr (g)} :
- Choose random {\ displaystyle c \ in GF (p ^ {2}) \ backslash GF (p)} .
- If {\ displaystyle F (c, \ X)} - we bring, we will return to the first step.
- We use the algorithm to search {\ displaystyle S_ {n} (c)} . Will find {\ displaystyle d = c _ {(p ^ {2} -p + 1) / q}} .
- If {\ displaystyle d} has an order not equal {\ displaystyle q} back to the first step.
- Let be {\ displaystyle Tr (g) = d} .
This algorithm calculates a field element {\ displaystyle GF (p ^ {2})} equivalent {\ displaystyle Tr (g)} for some {\ displaystyle g \ in GF (p ^ {6})} of order {\ displaystyle q} . [one]
Diffie-Hellman Protocol
Suppose Alice and Bob have an XTR public key {\ displaystyle \ left (p, q, Tr (g) \ right)} and they want to generate a shared private key {\ displaystyle K} .
- Alice picks a random number {\ displaystyle a \ in \ mathbb {Z}} such that {\ displaystyle 1 <a <q-2} calculates {\ displaystyle S_ {a} (Tr (g)) = \ left (Tr (g ^ {a-1}), Tr (g ^ {a}), Tr (g ^ {a + 1}) \ right) \ in GF (p ^ {2}) ^ {3}} and sends {\ displaystyle Tr (g ^ {a}) \ in GF (p ^ {2})} To bob.
- Bob gets {\ displaystyle Tr (g ^ {a})} from Alice, picks random {\ displaystyle b \ in \ mathbb {Z}} such that {\ displaystyle 1 <b <q-2} calculates {\ displaystyle S_ {b} (Tr (g)) = \ left (Tr (g ^ {b-1}), Tr (g ^ {b}), Tr (g ^ {b + 1}) \ right) \ in GF (p ^ {2}) ^ {3}} and sends {\ displaystyle Tr (g ^ {b}) \ in GF (p ^ {2})} Alice.
- Alice gets {\ displaystyle Tr (g ^ {b})} from Bob, calculates {\ displaystyle S_ {a} (Tr (g ^ {b})) = \ left (Tr (g ^ {(a-1) b}), Tr (g ^ {ab}), Tr (g ^ {( a + 1) b}) \ right) \ in GF (p ^ {2}) ^ {3}} and gets {\ displaystyle Tr (g ^ {ab}) \ in GF (p ^ {2})} - private key {\ displaystyle K} .
- Similarly, Bob computes {\ displaystyle S_ {b} (Tr (g ^ {a})) = \ left (Tr (g ^ {a (b-1)}), Tr (g ^ {ab}), Tr (g ^ {a (b + 1)}) \ right) \ in GF (p ^ {2}) ^ {3}} and gets {\ displaystyle Tr (g ^ {ab}) \ in GF (p ^ {2})} - private key {\ displaystyle K} .
El Gamal Scheme
Suppose Alice has a part of the XTR public key: {\ displaystyle (p, q, Tr (g))} . Alice picks a secret integer {\ displaystyle k} and calculates and publishes {\ displaystyle Tr (g ^ {k})} . Having received Alice’s public key {\ displaystyle \ left (p, q, Tr (g), Tr (g ^ {k}) \ right)} Bob can encrypt the message {\ displaystyle M} intended by Alice using the following algorithm:
- Bob picks random {\ displaystyle b \ in \ mathbb {Z}} such that {\ displaystyle 1 <b <q-2} and calculates {\ displaystyle S_ {b} (Tr (g)) = \ left (Tr (g ^ {b-1}), Tr (g ^ {b}), Tr (g ^ {b + 1}) \ right) \ in GF (p ^ {2}) ^ {3}} .
- Bob then calculates {\ displaystyle S_ {b} (Tr (g ^ {k})) = \ left (Tr (g ^ {(b-1) k}), Tr (g ^ {bk}), Tr (g ^ {( b + 1) k}) \ right) \ in GF (p ^ {2}) ^ {3}} .
- Bob defines a symmetric key {\ displaystyle K} based on {\ displaystyle Tr (g ^ {bk}) \ in GF (p ^ {2})} .
- Bob encrypts the message {\ displaystyle M} the key {\ displaystyle K} receiving an encrypted message {\ displaystyle E} .
- A couple {\ displaystyle (Tr (g ^ {b}), \ E)} Bob sends Alice.
Getting a pair {\ displaystyle (Tr (g ^ {b}), \ E)} Alice decodes her as follows:
- Alice calculates {\ displaystyle S_ {k} (Tr (g ^ {b})) = \ left (Tr (g ^ {b (k-1)}), Tr (g ^ {bk}), Tr (g ^ {b (k + 1)}) \ right) \ in GF (p ^ {2}) ^ {3}} .
- Alice defines a symmetric key {\ displaystyle K} based on {\ displaystyle Tr (g ^ {bk}) \ in GF (p ^ {2})} .
- Knowing that the message encryption algorithm is symmetric, Alice keyed {\ displaystyle K} decrypts {\ displaystyle E} receiving the original message {\ displaystyle M} .
Thus, the message is transmitted.