For any cryptosystem, it is desirable that it be proved that its hacking has computational complexity similar to the computational complexity of a task, which at the moment cannot be solved in the foreseeable time. Like RSA, the Williams cryptosystem is based on the assumption of the complexity of factorization of large numbers, and it was proved that for any hacking of ciphertext using preliminary cryptanalysis (having only a public key), it is necessary to factorize [1] , that is, solve the equation {\ displaystyle pq = n} regarding {\ displaystyle p} and {\ displaystyle q} . This claim has not been proven for the RSA system. The computational complexity of the factorization problem is unknown, but it is believed to be quite high. But, like RSA, the Williams cryptosystem is vulnerable to attack based on matched ciphertext.
The Williams system algorithm, while not computationally more complex than RSA, is much more cumbersome in the description. For him, there is a lemma [2] , which will be described in the section on the mathematical apparatus - it plays a key role in this cryptosystem.
Mathematical apparatus
First you need to define the terminology - it is borrowed from the theory of quadratic fields , but for the cryptosystem only the most basic knowledge is required. Let's consider an element
- {\ displaystyle \ alpha = a + b {\ sqrt {c}} = (a, b),}
Where {\ displaystyle a, b, c} Are integers, and {\ displaystyle {\ sqrt {c}}} - conditional element whose square is {\ displaystyle c} . Then the following formulas will be valid:
- {\ displaystyle \ alpha _ {1} + \ alpha _ {2} = (a_ {1} + a_ {2}, b_ {1} + b_ {2}),}
- {\ displaystyle \ alpha _ {1} \ cdot \ alpha _ {2} = (a_ {1} a_ {2} + c \ cdot b_ {1} b_ {2}, a_ {1} b_ {2} + a_ {2} b_ {1})}
Conjugate to {\ displaystyle \ alpha} the number is called
- {\ displaystyle {\ bar {\ alpha}} = ab {\ sqrt {c}}}
We also define functions that help us express the power of this number. Let be
- {\ displaystyle \ alpha ^ {i} = X_ {i} (\ alpha) + Y_ {i} (\ alpha) {\ sqrt {c}},}
then {\ displaystyle X_ {i}} and {\ displaystyle Y_ {i}} can be expressed through {\ displaystyle \ alpha ^ {i}} in the following way:
- {\ displaystyle X_ {i} (\ alpha) = (\ alpha ^ {i} + {\ bar {\ alpha}} ^ {i}) / 2}
- {\ displaystyle Y_ {i} (\ alpha) = b (\ alpha ^ {i} - {\ bar {\ alpha}} ^ {i}) / (\ alpha - {\ bar {\ alpha}}) = ( \ alpha ^ {i} - {\ bar {\ alpha}} ^ {i}) (2 {\ sqrt {c}})}
The last expression is intended only to simplify understanding. Since functions are defined for pairs {\ displaystyle (a, b)} then do not contain {\ displaystyle c} . Assuming now that {\ displaystyle a ^ {2} -b ^ {2} c = 1} , then we can write the following recurrence relations:
- {\ displaystyle X_ {2i} = 2 {X_ {i}} ^ {2} -1}
- {\ displaystyle Y_ {2i} = 2X_ {i} Y_ {i}}
- {\ displaystyle X_ {2i + 1} = 2X_ {i} X_ {i + 1} -X_ {1}}
- {\ displaystyle Y_ {2i + 1} = 2X_ {i} Y_ {i + 1} -Y_ {1}}
These formulas are designed for quick calculation. {\ displaystyle X_ {i}} and {\ displaystyle Y_ {i}} . As {\ displaystyle X_ {0} = 1} and {\ displaystyle X_ {1} = a} then {\ displaystyle X_ {i} (\ alpha)} also independent of {\ displaystyle b} .
Lemma
Let be {\ displaystyle n} is a product of two odd primes {\ displaystyle p} and {\ displaystyle q} ; {\ displaystyle a, b, c} are integers satisfying the equation {\ displaystyle a ^ {2} -cb ^ {2} = 1 {\ pmod {n}}} . Let the Legendre Symbols {\ displaystyle \ delta _ {p} =} {\ displaystyle \ textstyle \ left ({\ frac {c} {p}} \ right)} and {\ displaystyle \ delta _ {q} = \ textstyle \ left ({\ frac {c} {q}} \ right)} satisfy comparisons
{\ displaystyle \ delta _ {p} = - p {\ pmod {4}}} {\ displaystyle \ delta _ {q} = - q {\ pmod {4}}} .
Let further {\ displaystyle gcd (cb, n) = 1} and the Jacobi Symbol {\ displaystyle \ textstyle \ left ({\ frac {2 (a + 1)} {n}} \ right)} equal to 1. Denote
{\ displaystyle m = (p- \ delta _ {p}) (q- \ delta _ {q}) / 4} and we believe that {\ displaystyle e} and {\ displaystyle d} satisfy comparison
{\ displaystyle ed = (m + 1) / 2 {\ pmod {m}}} .
Under these assumptions
{\ displaystyle \ alpha ^ {2ed} = \ pm \ alpha {\ pmod {n}}} Key Creation
Two prime numbers are selected first {\ displaystyle p} and {\ displaystyle q} , their product is calculated {\ displaystyle n} . Using enumeration, select a number {\ displaystyle c} so that the symbols of Legendre {\ displaystyle \ delta _ {p}} and {\ displaystyle \ delta _ {q}} satisfy the conditions imposed in the lemma. Then (also by selection) the number is determined {\ displaystyle s} such that the symbol of Jacobi
- {\ displaystyle \ textstyle \ left ({\ frac {s ^ {2} -c} {n}} \ right) = - 1}
and {\ displaystyle gcd \ textstyle \ left (s, n \ right) = 1.} Number {\ displaystyle m} is chosen in the same way as in the lemma:
- {\ displaystyle m = (p- \ delta _ {p}) (q- \ delta _ {q}) / 4}
Then select numbers {\ displaystyle d, e} satisfying the conditions imposed in the lemma. We choose a random one, for example, {\ displaystyle d: gcd \ textstyle \ left (d, m \ right) = 1} , but {\ displaystyle e} calculate by the formula
- {\ displaystyle e = {\ frac {m + 1} {2}} d ^ {- 1} {\ pmod {m}}}
Then {\ displaystyle {n, e, c, s}} Is the public key, and {\ displaystyle {p, q, m, d}} - The secret key.
Encryption
All calculations here are modulo {\ displaystyle n} . Record {\ displaystyle a + b {\ sqrt {c}} {\ pmod {n}}} here means {\ displaystyle (a \ mod n) + (b \ mod n) {\ sqrt {c}}.} Imagine plain text as a number {\ displaystyle w \ in {2,3, ..., n-1}} . Define {\ displaystyle \ gamma} and {\ displaystyle b_ {1}} : if the symbol is Jacobi {\ displaystyle \ textstyle \ left ({\ frac {w ^ {2} -c} {n}} \ right)} is equal to {\ displaystyle +1} then
- {\ displaystyle b_ {1} = 0} and {\ displaystyle \ gamma = w + {\ sqrt {c}},}
otherwise define {\ displaystyle \ gamma} through the work
- {\ displaystyle b_ {1} = 1} and {\ displaystyle \ gamma = (w + {\ sqrt {c}}) (s + {\ sqrt {c}}.}
Then it’s easy to make sure that the Jacobi symbol
- {\ displaystyle \ textstyle \ left ({\ frac {\ gamma {\ bar {\ gamma}}} {n}} \ right) = 1,}
which is verified by direct calculation (in the second case, taking into account the choice {\ displaystyle s} and the multiplicity of the Jacobi symbol). Next we find the number
- {\ displaystyle \ alpha = {\ frac {\ gamma} {\ bar {\ gamma}}}.}
Imagine {\ displaystyle \ alpha} as {\ displaystyle \ alpha = a + b {\ sqrt {c}}.} {\ displaystyle \ alpha} satisfies the conditions imposed in the lemma. Really, {\ displaystyle p, q, n, c, d, e} satisfy the conditions for construction, and
- {\ displaystyle \ alpha {\ bar {\ alpha}} = {\ frac {\ gamma} {\ bar {\ gamma}}} {\ frac {\ bar {\ gamma}} {\ gamma}} = 1.}
- {\ displaystyle 2 (a + 1) = {\ frac {\ gamma} {\ bar {\ gamma}}} + {\ frac {\ bar {\ gamma}} {\ gamma}} + 2 = {\ frac { (\ gamma + {\ bar {\ gamma}}) ^ {2}} {{\ bar {\ gamma}} \ gamma}} {\ pmod {n}}}
It follows from the last formula that
- {\ displaystyle \ textstyle \ left ({\ frac {2 (a + 1)} {n}} \ right) = 1.}
Having received {\ displaystyle \ alpha,} it should be encrypted by exponentiation {\ displaystyle e} - the result can be presented through {\ displaystyle X_ {e} (\ alpha)} and {\ displaystyle Y_ {e} (\ alpha),} which can be [3] quickly (for the number of operations of order {\ displaystyle \ log e} ) are found using recurrence formulas. We introduce the notation
- {\ displaystyle E = {\ frac {X_ {e} (\ alpha)} {Y_ {e} (\ alpha)}}
Then the cryptographic text will be a triple of numbers {\ displaystyle (E, b_ {1}, b_ {2}),} Where {\ displaystyle b_ {2} = a \ mod 2.}
Decryption
Decryption is easier. First calculated
- {\ displaystyle \ alpha ^ {2e} = {\ frac {\ alpha ^ {2e}} {{(\ alpha {\ bar {\ alpha}})} ^ {e}}} = {\ frac {E + {\ sqrt {c}}} {E - {\ sqrt {c}}},}
what an attacker can do. But for the final decryption it is necessary to calculate, as shown in the lemma, {\ displaystyle \ alpha ^ {2ed}} - despite the fact that {\ displaystyle d} kept secret.
- {\ displaystyle \ alpha ^ {2ed} = X_ {d} (\ alpha ^ {2e}) + Y_ {d} (\ alpha ^ {2e}) {\ sqrt {c}} = \ pm \ alpha}
Number {\ displaystyle b_ {2},} transmitted in the message will indicate which of the signs is correct - the one that gives an even result or the one that gives an odd one. Number {\ displaystyle b_ {1}} will show if the result should be multiplied by {\ displaystyle (s - {\ sqrt {c}}) / (s + {\ sqrt {c}})} . As a result, we get the number
- {\ displaystyle \ alpha '= {\ frac {w + {\ sqrt {c}}} {w - {\ sqrt {c}}}}}
And we can easily find the source text, which will complete the decryption process.
- {\ displaystyle w = {\ frac {\ alpha '+1} {\ alpha' -1}} {\ sqrt {c}}}
Like RSA, an attack based on the selected ciphertext can be attacked on the cryptosystem. Suppose that a cryptanalyst found some algorithm that allows with probability {\ displaystyle \ delta> 0} decrypt cryptotext. Then he can do as follows:
- 1. Choose a number {\ displaystyle \ phi} such that the symbol of Jacobi {\ displaystyle \ textstyle \ left ({\ frac {\ phi ^ {2} -c} {n}} \ right) = - 1} ;
- 2. Encrypt {\ displaystyle \ phi} but in such a way as if the mentioned Jacobi symbol is equal {\ displaystyle +1} and {\ displaystyle b_ {1} = 0} receiving cryptotext as an output {\ displaystyle (E, 0, b_ {2})} ;
- 3. Decrypt the received cryptotext, having received some {\ displaystyle \ psi \ neq \ phi} .
Then with probability {\ displaystyle \ delta> 0} cryptanalyst can get
- {\ displaystyle \ phi - \ psi = p {\ pmod {n}}}
or
- {\ displaystyle \ phi - \ psi = q {\ pmod {n}}}
What allows factorization {\ displaystyle n} and crack the cryptosystem.
After the key is generated, the basic calculations occur when the number is raised {\ displaystyle \ alpha} to a degree, and this can be done for {\ displaystyle O (\ log e)} multiplications modulo each of which occurs for {\ displaystyle O (\ log e)} addition operations, in turn, performed for {\ displaystyle O (\ log e)} elementary operations of addition of constant speed - that is, beyond {\ displaystyle O (\ log ^ {3} e)} , at the same speed as raising to a power an integer modulo that is required to use RSA.
Key Generation
We choose, for example, {\ displaystyle p = 11} and {\ displaystyle q = 13} whose work is {\ displaystyle n = 143} . As
- {\ displaystyle \ left ({\ frac {5} {11}} \ right) = 1 = -11 {\ pmod {4}}}
and
- {\ displaystyle \ left ({\ frac {5} {13}} \ right) = - 1 = -13 {\ pmod {4}}}
Can choose {\ displaystyle c = 5} . Also, if you choose {\ displaystyle s = 2} we get
- {\ displaystyle \ left ({\ frac {s ^ {2} -c} {n}} \ right) = \ left ({\ frac {-1} {11}} \ right) \ left ({\ frac { -1} {13}} \ right) = - 1}
Which satisfies the hypothesis of the theorem. Next we get
- {\ displaystyle m = \ left ({\ frac {10 \ cdot 14} {4}} \ right) = 35}
And finally, we choose the exponents of encryption and decryption: since
- {\ displaystyle 23 \ cdot 16 = 18 {\ pmod {m}}}
Can choose
- {\ displaystyle e = 23}
- {\ displaystyle d = 16}
Encryption
Let the source text be {\ displaystyle \ omega = 21} . As
- {\ displaystyle \ left ({\ frac {21 ^ {2} -5} {143}} \ right) = \ left ({\ frac {7} {11}} \ right) \ left ({\ frac {7 } {13}} \ right) = (- 1) \ cdot (-1) = 1}
We have {\ displaystyle b_ {1} = 0} , {\ displaystyle \ gamma = 21 + {\ sqrt {5}}} and
- {\ displaystyle \ alpha = \ left ({\ frac {21 + {\ sqrt {5}}} {21 - {\ sqrt {5}}} \ right) = 125 + 6 {\ sqrt {5}} { \ pmod {143}}}
As {\ displaystyle 125} odd, we get {\ displaystyle b_ {2} = 1} . After calculating {\ displaystyle X_ {23} (\ alpha) = 68} and {\ displaystyle Y_ {23} (\ alpha) = 125} we get
- {\ displaystyle E = 68 \ cdot {125} ^ {- 1} = 68 \ cdot 135 = 28 {\ pmod {143}}}
So the ciphertext is the triple {\ displaystyle (28,1,1)} .
Decryption
Now you should calculate {\ displaystyle \ alpha ^ {2e}} :
- {\ displaystyle \ alpha ^ {2e} = \ left ({\ frac {28 ^ {2} +5} {28 ^ {2} -5}} \ right) +2 \ cdot \ left ({\ frac {28 } {28 ^ {2} -5}} \ right) {\ sqrt {5}} = 95 + 126 {\ sqrt {5}} {\ pmod {143}}}
As {\ displaystyle d = 16} , we also calculate
- {\ displaystyle X_ {16} (\ alpha ^ {2e}) = 18}
- {\ displaystyle Y_ {16} (\ alpha ^ {2e}) = 137}
As {\ displaystyle b_ {2} = 1} then {\ displaystyle a} must be odd and
- {\ displaystyle \ alpha '= - (18 + 137 {\ sqrt {5}}) = 125 + 6 {\ sqrt {5}} {\ pmod {143}}}
Given that the second component of ciphertext {\ displaystyle b_ {1} = 0} , we conclude that {\ displaystyle \ alpha '= \ alpha} . In this case
- {\ displaystyle \ omega = {\ frac {126 + 6 {\ sqrt {5}}} {124 + 6 {\ sqrt {5}}}} {\ sqrt {5}} = 21 {\ pmod {143}} } .
So we got {\ displaystyle \ omega = 21} , which was the original plaintext.