METHODS AND SYSTEMS FOR ENCRYPTING RATIONAL NUMBERS AND ADDING RANDOMNESS TO RSA CRYPTOSYSTEMS USING P-ADIC NUMBERS

Information

  • Patent Application
  • 20220407719
  • Publication Number
    20220407719
  • Date Filed
    August 19, 2022
    2 years ago
  • Date Published
    December 22, 2022
    a year ago
Abstract
Disclosed are methods and systems to use p-adic numbers to permit a RSA cryptosystem to send rational numbers or to add randomness to the RSA cryptosystem. An embodiment may convert at the source device a rational number to an integer as p-adic based Hensel code representation of the rational number at the source device and then recover the rational number at the destination device by reversing the Hensel code back to the original rational number. Another embodiment may use a g-adic inverse of a message value together with a random number to obtain a different rational number to encrypt for each different random number resulting in different ciphertexts representing the same message value while still recovering the original message value despite having a different ciphertexts for the same message value. The various embodiments further retain the multiplicative homomorphism of the RSA cryptosystem since the p-adic Hensel codes are also multiplicative homomorphic.
Description
BACKGROUND OF THE INVENTION

The advancement of science is possible when knowledge is shared and information is exchanged in a seamless manner. In a world where many businesses rely on information as their main assets, analysis over data is a crucial competitive advantage. Consequently, the amount of data processed and stored will continue to increase, creating a demand for virtualized services. To this end, some applications can be provided as cloud computing resources including Internet of Things (IoT), machine learning, virtual reality (VR) and blockchain. As a result, concerns about custody and privacy of data are on the rise.


Modern concealment/encryption employs mathematical techniques that manipulate positive integers or binary bits. Asymmetric concealment/encryption, such as RSA (Rivest-Shamir-Adleman), relies on number theoretic one-way functions that are predictably difficult to factor and can be made more difficult with an ever-increasing size of the encryption keys. Symmetric encryption, such as DES (Data Encryption Standard) and AES (Advanced Encryption Standard), uses bit manipulations within registers to shuffle the concealed text/cryptotext to increase “diffusion” as well as register-based operations with a shared key to increase “confusion.” Diffusion and confusion are measures for the increase in statistical entropy on the data payload being transmitted. The concepts of diffusion and confusion in encryption are normally attributed as first being identified by Claude Shannon in the 1940s. Diffusion is generally thought of as complicating the mathematical process of generating unencrypted (plain text) data from the encrypted (cryptotext) data, thus, making it difficult to discover the encryption key of the concealment/encryption process by spreading the influence of each piece of the unencrypted (plain) data across several pieces of the concealed/encrypted (cryptotext) data. Consequently, an encryption system that has a high degree of diffusion will typically change several characters of the concealed/encrypted (cryptotext) data for the change of a single character in the unencrypted (plain) data making it difficult for an attacker to identify changes in the unencrypted (plain) data. Confusion is generally thought of as obscuring the relationship between the unencrypted (plain) data and the concealed/encrypted (cryptotext) data. Accordingly, a concealment/encryption system that has a high degree of confusion would entail a process that drastically changes the unencrypted (plain) data into the concealed/encrypted (cryptotext) data in a way that, even when an attacker knows the operation of the concealment/encryption method (such as the public standards of RSA, DES, and/or AES), it is still difficult to deduce the encryption key.


Homomorphic Encryption is a form of encryption that allows computations to be carried out on concealed cipher text as it is concealed/encrypted without decrypting the cipher text that generates a concealed/encrypted result which, when decrypted, matches the result of operations performed on the unencrypted plaintext.


The word homomorphism comes from the ancient Greek language: óμóç (homos) meaning “same” and μoρφ{acute over (η)} (morphe) meaning “form” or “shape.” Homomorphism may have different definitions depending on the field of use. In mathematics, for example, homomorphism may be considered a transformation of a first set into a second set where the relationship between the elements of the first set are preserved in the relationship of the elements of the second set.


For instance, a map f between sets A and B is a homomorphism of A into B if






f(a1op a2)=f(a1)op f(a2)|a1,a2∈A


where “op” is the respective group operation defining the relationship between A and B.


More specifically, for abstract algebra, the term homomorphism may be a structure-preserving map between two algebraic structures such as groups, rings, or vector spaces. Isomorphisms, automorphisms, and endomorphisins are typically considered special types of homomorphisms. Among other more specific definitions of homomorphism, algebra homomorphism may be considered a homomorphism that preserves the algebra structure between two sets.


SUMMARY OF THE INVENTION

An embodiment of the present invention may comprise a method for encrypting a rational number a with a RSA (Rivest-Shamir-Adleman) cryptosystem for communication between a source device and a destination device wherein the RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n=pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1)(g−1) and d=e−1 mod ϕ(n), the method comprising: encoding by the source device the rational number a using p-adic based integer Hensel encoding as a function of a Hensel encoding value v and the rational number a to obtain integer Hensel code h, where the rational number a is comprised of a fraction a/b with numerator a and denominator b, where the numerator a, denominator h, and Hensel encoding value v are pairwise coprime, and where an absolute value of the numerator a and denominator b are less than the Hensel encoding value v; encrypting by the source device the integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c; sending by the source device the ciphertext c to the destination device; decrypting by the destination device the ciphertext c using RSA decryption processes to obtain the integer Hensel code h; and decoding by the destination device the integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of the Hensel encoding value v and the Hensel code h to obtain the corresponding rational number a.


An embodiment of the present invention may further comprise a method for randomizing ciphertexts of a message value m for a RSA (Rivest-Shamir-Adleman) cryptosystem for communication between a source device and a destination device wherein the RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n=pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1)(g−1) and d=e−1 mod ϕ(n), the method comprising: computing by the source device a g-adic number inverse Hg−1 as a function of a first prime number x and a second prime number y acting as prime numbers for the g-adic number inverse Hg−1, and the message value in and a random number s acting as Hensel codes for the g-adic number inverse Hg−1 to obtain rational number a, where the random number s is changed for each subsequent encryption operation and the rational number a is comprised of a fraction a/b with numerator a and denominator b, and such that the rational number a is different for each different random numbers in the subsequent encryption operations for the message value in that does not change so as to randomize a ciphertext value c based on the rational number a that changes as the random number s is changed even when the message value m remains constant; encoding by the source device the rational number a using p-adic based integer Hensel encoding as a function of the public key n and the rational number a to obtain integer Hensel code h; encrypting by the source device the integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c; sending by the source device the ciphertext c to the destination device; decrypting by the destination device the ciphertext c using RSA decryption processes to obtain the integer Hensel code h; decoding by the destination device the integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of the public key n and the Hensel code h to obtain the corresponding rational number a; and encoding by the destination device the rational number a using p-adic based integer Hensel encoding as a function of the first prime number x and the rational number a to obtain message value m that is a Hensel code of the rational number a.


An embodiment of the present invention may further comprise an RSA (Rivest-Shamir-Adleman) cryptosystem that encrypts a rational number a for communication between a source device and a destination device wherein the RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1) (q−1) and d=e−1 mod ϕ(n), the RSA cryptosystem comprising: the source device, wherein the source device further comprises: a Hensel code encoding subsystem that encodes device the rational number a using p-adic based integer Hensel encoding as a function of a Hensel encoding value v and the rational number a to obtain integer Hensel code h, where the rational number a is comprised of a fraction a/b with numerator a and denominator b, where the numerator a, denominator b, and Hensel encoding value v are pairwise coprime, and where an absolute value of the numerator a and denominator b are less than the Hensel encoding value v; an encryption subsystem that encrypts the integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c; and a send subsystem that sends the ciphertext c to the destination device; and the destination device, wherein the destination device further comprises: a decryption subsystem that decrypts the ciphertext c using RSA decryption processes to obtain the integer Hensel code h; and a Hensel code decode subsystem that decodes the integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of the Hensel encoding value v and the Hensel code h to obtain the corresponding rational number a.


An embodiment of the present invention may further comprise an RSA (Rivest-Shamir-Adleman) cryptosystem that for randomizes ciphertexts of a message value in for communication between a source device and a destination device wherein the RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n=pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1)(q−1) and d=e−1 mod ϕ(n), the RSA cryptosystem comprising: the source device, wherein the source device further comprises: a g-adic number inverse subsystem that computes a g-adic number inverse Hg−1 as a function of a first prime number x and a second prime number y acting as prime numbers for the g-adic number inverse Hg−1, and the message value m and a random number s acting as Hensel codes for the g-adic number inverse Hg−1 to obtain rational number a, where the random number s is changed for each subsequent encryption operation and the rational number a is comprised of a fraction a/b with numerator a and denominator b, and such that rational number a is different for each different random number s in the subsequent encryption operations for the message value m that does not change so as to randomize a ciphertext value c based on the rational number a that changes as the random number s is changed even when the message value in remains constant; a Hensel code encoding subsystem that encodes the rational number a using p-adic based integer Hensel encoding as a function of the public key n and the rational number a to obtain integer Hensel code h; an encryption subsystem that encrypts the integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c; and a send subsystem that sends the ciphertext c to the destination device; and the destination device, wherein the destination device further comprises: a decryption subsystem that decrypts the ciphertext c using RSA decryption processes to obtain the integer Hensel code h; a Hensel code decode subsystem that decodes the integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of the public key n and the Hensel code h to obtain the corresponding rational number a; and a Hensel code message recovery subsystem that encodes the rational number a using p-adic based integer Hensel encoding as a function of the first prime number x and the rational number a to obtain message value in that is a Hensel code of the rational number a.





BRIEF DESCRIPTION OF THE DRAWINGS

In the drawings,



FIG. 1 is a block diagram of the hardware implementation for a p-adic number enhanced RSA cryptosystem embodiment.



FIG. 2 is a flow chart of a p-adic number enhanced RSA cryptosystem embodiment for encrypting rational numbers.



FIG. 3 is a flow chart of a p-adic number enhanced RSA cryptosystem embodiment for randomizing ciphertext values.





DETAILED DESCRIPTION OF THE EMBODIMENTS

1. Introduction


The 1970s and 1980s were very important times for cryptography since it was during this particular period that most of the mathematical ideas for modern cryptography were established. In 1976, Diffie and Hellman proposed methods for key exchange and digital signatures in which the security is related to the discrete logarithm problem in finite fields. In 1978, Merkle introduced a method for secret key distribution based on randomized “puzzles.”. Later in 1978 Rivest, Shamir and Adleman (RSA) introduced a method for obtaining digital signatures and public key cryptosystems, which was later referred to as the RSA cryptosystem, based on the factorization problem. Yet in 1978, McEliece proposed a public-key encryption scheme based on Goppa codes. As noted by Hellman, the aforementioned authors are considered the first publicly known proponents of public-key cryptosystems. Among these, the Diffie-Hellman key exchange and the RSA cryptosystem are of special relevance in the history of cryptography up to present time given they are not only two of the first public-key cryptosystems but also cryptosystems based on number theory. None of the aforementioned works proved secure. In fact, at that point in time, formal definitions of security were not yet in place and some of the schemes proposed (e.g., RSA) were actually demonstrably insecure. However, they are all relevant from a historical standpoint.


In 1985 Miller and in 1978 Koblitz, independently, proposed the use of elliptic curves in cryptography in which it is possible to construct cryptographic protocols based on the elliptic curve discrete logarithm problem. For this reason, it is possible to implement the ideas of Diffie and Hellman with elliptic curves, which is known as elliptic curve Diffie-Hellman, as well as providing a signature scheme with the elliptic curve digital signature algorithm. Many other protocols based on the discrete logarithm problem have been implemented with elliptic curves where all the solutions to cryptography that are based on elliptic curves are identified as elliptic curve cryptography (ECC).


In 1996, Ajtai introduced a class of random problems in lattice theory which are demonstrated to be difficult to solve based on the shortest vector problem, and in 1997 Ajtai and Dwork introduced a public-key cryptosystem based on lattices while showing that the average case of the problems showcased by Ajtai were as hard as the worst-case ones. In 1998 Hoffstein, Pipher and Silverman proposed lattice-ring-based public-key cryptosystem and in 2005 Regev introduced another public-key cryptosystem based on the problem of learning with errors, which can be related to lattice problems. Many authors found lattices a promising mathematical resource for constructing cryptographic solutions and soon enough the term lattice-based cryptography was adopted to identify the set of cryptographic solutions supported by lattice theory. In 2009 Gentry introduced the first fully homomorphic encryption scheme which was based on ideal lattices followed by several other lattice-based variants. As it happened with ECC, lattice-based cryptography is an active field of research.


As can be seen, elliptic curves and lattices are two examples of mathematical resources in which researchers encounter a vastness of opportunities for constructing cryptographic solutions to the extent of creating their own branch of research within cryptography. The various embodiments take advantage of another mathematical resource that is similarly rich, versatile, intuitive and powerful, namely, the p-adic number theory. Although p-adic numbers are somehow present in some cryptographic contexts, it has today a minor role when compared with p-adic number theory's potential of being a major field of research in cryptography. When proposing the use of elliptic curves in cryptography, Miller remarked that his intent was to “show that elliptic curves have a rich enough arithmetic structure so that they will provide a fertile ground for planting the seeds of cryptography.” Analogously, the disclosure of the various embodiments is expected to show that p-adic numbers have a rich arithmetic structure to arouse a growing research interest on p-adic number theory's properties aimed at cryptographic constructions.


1.1 Our Contribution


We propose a modern, self-contained and minimum required elementary introduction to the p-adic number theory with emphasis in a distinct subset of properties and functions that we identify as valuable to cryptography. We provide efficient algorithms for the main mappings within the p-adic arithmetic alongside insights and practical examples of how to use them in the context of cryptography. We propose methods for allowing crypto algorithms over the integers to accept rational numbers. As we approach security concerns in cryptography viap-adic numbers, we introduce methods for adding randomness to deterministic crypto algorithms that can be easily extended to be able to randomize just about any deterministic algorithm. We propose a protocol for distributed computation where any input can be transformed into an arbitrary number of p-adic digits where number k of parties perform a joint computation, each one on their individual digit without having any knowledge of what that digit represents and what the other digits are. In a similar approach we propose methods for aiding parallel computation and we demonstrate how to parallelize a given function in terms of p-adic digits. By combining properties of our discussed constructions, we introduce a fully homomorphic encryption (FHE) scheme and we show its connection with the prime factorization and the discrete logarithm problem from a Hensel's lemma perspective.


1.2 Related Work


In 1817, Kurt Hensel introduced the p-adic number theory and since then it has been studied as part of Number Theory, however, it was only in the 1970s and 1980s that this branch of mathematics had any traction due to the work of Krishnamurthy, Rao, and Subramanian, and Alparslan when they found that the finite segment of the p-adic arithmetic was an efficient solution for error-free computation. During this period, other researchers became interested in error-free computation via p-adic numbers and helped to consolidate the finite segment p-adic number theory for practical applications in several areas of physics, engineering and computer science. The subject rapidly advanced with the contributions of Gregory, Beiser, Farinmade, Hehner and Horspool, and Lewis, among others. The practical implications of working with the finite p-adic arithmetic for error-free computation were so vast that Rao remarked that would not need to have a complete understanding of the theoretical aspects of p-adic numbers in order to work with its finite segment, since the theory of the finite segment p-adic had become a well-organized and a nearly self-sufficient subset of the theory of p-adic numbers. Krishnamurthy, Rao, and Subramanian named the finite-segment p-adic numbers as Hensel codes. Along-side with error-free computation, p-adic numbers have been successfully applied to parallel computation. The theory of p-adic numbers is currently present in many other theories, including the theory of dynamical systems, theoretical physics, number theory, algebraic geometry, non-Archemdian analysis, differential calculus, topology, and analytic functions.


2. p-adic Numbers


Let p be prime. Any positive integer x can be represented uniquely as an expansion of the form x=a0+a1p+a2p2++anpn for some n, where a1 is an integer with 0≤ai≤p. That is, a0+a1p+a2p2+anpn is the base-p representation of x. One of Hensel's main motivations was to relate the integers custom-character to the field of rationals custom-character, which gives rise to the p-adic number system. In the p-adic number system, all rational numbers in the field of rational numbers custom-character are represented as unique infinite expansions α=Σaipi, where i is an integer and the value for any given ai is in the range [0,p−1]. In this work we focus our attention on the finite-segment p-adic number theory and from now on we discuss its foundation, main properties and opportunities for possible practical applications.


2.1 Hensel Codes


Gregory and Krishnamurthy remarked that there are a large number of ill-conditioned problems as well as numerically unstable algorithms in which cases rounding errors cannot be tolerated during computation. As one approach to solve this problem one might apply finite number systems (also known as residue number systems or RNS) in which one is able to perform computations free of rounding errors. The most common RNS number systems are probably the single-modulus and multiple-modulus. In this section we discuss another method to achieve error-free computation with truncated infinite p-adic expansions known as Hensel Codes (see Definition 3 below). Hensel's Lemma showed that increasing the number of terms in a p-adic expansion is equivalent to finding a unique integer root for a larger power of p. In the finite-segment p-adic number system, each rational number in a given finite set of custom-character is mapped to a unique integer root that will be referred to as an integer Hensel code. Computations performed over Hensel codes are mathematically equivalent to computations performed over their corresponding rational numbers, which was shown with infinite p-adic expansions; however, there are some special considerations to preserve uniqueness and correctness when working with the truncated expansions. The finite-segment p-adic arithmetic, as a type of RNS, is free of rounding errors.


Definition 1. A residue number system (RNS) is a numerical system in which an integer x∈{0, . . . , M−1}, where M=Πi=1kmi, is uniquely represented in terms of its congruences with a set of k distinct and pairwise coprime moduli {m1, . . . , mk}, which generate a set of k remainders {x1, . . . , xk} such that xi=x mod mi and 0≤xi≤mi, for i=1 . . . k, such that there is a ring isomorphism guaranteed by the Chinese Remainder Theorem (CRT).


A p-adic expansion is a summation of the form Σi=kai pi, with ai∈(0, . . . , p−1). Any p-adic expansion naturally gives rise to the sequence of partial sums (αn) where αni=knmi. Note that this is always a Cauchy sequence with respect to the p-adic absolute value, and so every p-adic expansion can be said to converge to an element of p. A p-adic expansion is finite if it contains only a finite number of non-zero p-adic digits. Given a prime p, let an element h in custom-characterp that represents a rational α be a p-adic digit. In integer representation, if multiple primes are used to encode α, say (p1, . . . , pk), then a is represented by multiple p-adic digits (h1, . . . , hk) where hi custom-characterp, i=1 . . . k.


Definition 2. For any prime p, the finite-segment p-adic number system is the replacement of the arithmetic over the rational numbers by the arithmetic over the integers modulo p.


Theorem 1. The finite-segment p-adic number system is a RNS (residue number system).


Proof. It is easier to prove the finite p-adic number system as a RNS for k p-adic digits where k>1. However, we generalize it as follows: consider a k-digit Hensel code, for k≥1, and g=Πi=1k pi. The Hensel code of α=a/h encoded with g is an integer x ab−1 mod g, for x∈{0, . . . , g−1}, such that each individual Hensel digit corresponding to each pi in g is computed as:





(h1, . . . ,hk)=(x mod p1, . . . ,x mod pk)  Eq. 1


For the particular case where k=1, it is obvious that h=x mod p.


Remark 1. Arithmetic in the finite-segment p-adic number system is equivalent to the single-modulus RNS if the single modulus is an integer of the form m=pr where p is a prime number and r is an arbitrary positive integer.


Definition 3. The r-order Hensel code of a rational number a is the truncation of the p-adic expansion of a to r digits. We write this as H (p, r, a).


Theorem 2 shows one approach for mapping to Hensel codes. The method finds the partial sum of an infinite p-adic expansion, converts it to radix-p form, and reverses the order of the digits.


Theorem 2. For all α=a/b in custom-character there is a n∈custom-character such that we can rewrite a/b as:










a
b

=


c
d



p
n






Eq
.

2







where gcd (c, d)=gcd (c, p)=gcd (d, p)=1. (gcd—greatest common denominator) We can then write the Hensel code for c/d as:






H(p,r,c/d)=a0a1ar−1,  Eq. 3


where ar−1 . . . a0a1 is the base p representation for the integer cd−1 mod pr. In other words,






cd
−1 mod pr=a0+a1p+a2p2+ar−1pr−1.  Eq. 4


Proof Let c/d be computed by the following p-adic expansion:










c
d

=





j
=
0





a
j



p
j



=



(


a
0

+


a
1


p

+


+


a

r
-
1




p

r
-
1




)

+


p
r




R
r

.








Eq
.

5







Then we write c=d(a0+a1p+ar−1pr−1)+pr(dRr). Then,






c mod pr=d(a0+a1p++ar−1pr−1)mod pr,  Eq. 6


which implies:






cd
−1 mod pr=a0+a1p+ . . . +ar−1pr−1,  Eq. 7


Example 1. Consider α=8/3∈custom-character, r=4, and p=5. Find the partial sum corresponding infinite p-adic expansion.










c


d

-
1





mod

p

r


=



8
·

3

-
1






mod

625


=



8
·
417


mod

625.

=


3336

mod

625.

=
211







Eq
.

8







The sum of the truncated expansion is 211 in base 10, which is 1321 in base 5. Reversing the order of the digits and placing a p-adic point gives a=0.1231.


Example 2. Consider the two rational numbers α=3/4 and β=381/76 mapped to custom-character3. The Hensel codes with r=4 are given below.






H(p=3,r=4,α=31(1/4))=31[(1·61)mod 81]=16  Eq. 9






H(p=3,r=4,β=31(127/76))=31[(127·16)mod 81]=16  Eq. 10


Verify,








ad
=


cb

mod


p

r




228

=


1524

mod

81

=
66






Eq
.

11







The resulting Hensel codes are identical, which illustrates that uniqueness is no longer valid for every α∈custom-characterp in the finite-segment number system. As a result, a finite set of custom-characterp is defined to ensure uniqueness and correctness for Hensel codes, and arithmetic on Hensel codes. The set of order-N Farey fractions, originally denoted by custom-characterN, is classically defined in various texts. However, we propose new notation and a new definition for the order-N Farey fractions with respect to a prime p which is consistent with the applications ofp-adic numbers throughout this work. But before introducing the new notation and new definitions we will discuss the basics of the mapping between order-N Farey fractions and Hensel codes over the integers.


2.2 Hensel Code Mappings Over the Integers


Section 2.1 showed two different methods for obtaining a Hensel code. In this section, we introduce the integer Hensel code, which is simply the partial sum of the truncated p-adic expansion. All previous examples with infinite p-adic expansions showed that given enough terms, the convergence for an expansion is found by arranging the terms as a geometric series. However, if enough terms are not given, a truncated p-adic expansion cannot be represented as a geometric series, which calls for an alternative method to solve for convergence of an integer Hensel code to the corresponding rational number in custom-character. The Extended Euclidean Algorithm (EEA) is one method to obtain the corresponding rational number.


From this point on, we will consider an isomorphic mapping between the order-N Farey fractions and a corresponding set of Hensel codes with respect to pr for r=1. Thus, we will suppress r in the notation for clarity. The reason for this decision will be discussed next.


Theorem 3. Given α=a/b and p such that a, b, and p are pairwise coprime, and |a|, |b|<p there is a unique value of h=H(p, a), h<p which is computed as follows:






h=H(p,α)=ab−1 mod p,  Eq. 12


where V is the modular multiplicative inverse of b with respect top.


Proof. The computation of h as in Eq. 12 is fairly intuitive. Recall that any rational number a/b can be rewritten as a·b−1=a·1/b. However, while working with arithmetic mod p, we compute a·b−1 mod p such that h−1 is the only integer that satisfies b·b−1 mod p=1. The value of a can be obtained from h by solving a=bh+kp, where k=(a−bh)/p. This is a Diophantine equation which can be solved by the EEA. We thus have a=bh kp and b=(a−kp)/h and therefore h can be alternatively computed as h=(a−kp)/b.


Definition 4. A convergent is a rational number obtained via a limited number of terms in a continued fraction and it is typically denoted by pn/qn for n convergents of a rational number x where pn/qn is the n-th convergent of x.


Kraeft remarked that every irreducible rational number a/h which satisfies the inequality:












"\[LeftBracketingBar]"



c
d

-

a
b




"\[RightBracketingBar]"


<

1

2


b
2







Eq
.

13







is convergent of c/d.


Lemma 1. For all p/q, x∈custom-character, if













"\[LeftBracketingBar]"


x
-


p
n


q
n





"\[RightBracketingBar]"




1


q
n



q

n
+
1




<

1

q
n
2



,




Eq
.

14







then p/q is a convergent of x.


Proof. In order to find the distance between a convergent







p
n


q
n





of a continued traction and the fraction itself x, we begin by establishing,










[


a
0

,

a
1

,


,

a
n


]

=


a
0

+

1


a
1

+

1


a
2

+





1

a
n












Eq
.

15








and














p
0

=

a
0


,






q
0

=
1

,





p
n

=



a
n



p

n
-
1



+

p

n
-
2











p
1

=



a
1



a
0


+
1


,





q
1

=

a
1






q
n

=



a
n



q

n
-
1



+

q

n
-
2







.




Eq
.

16









Thus
,










a
n

=



p
n


q
n


=

{





a
0

,

n
=
0









a
0

+

1

a
1



,

n
=
1











a
n



p

n
-
1



+

p

n
-
2






a
n



q

n
-
1



+

q

n
-
2




,

n

2











Eq
.

17







Every an is a partial quotient of the continued fraction, which has a corresponding complete quotient an′=ann with 0≤ξn<1. As a result, x can be represented as






x
=





a

n
+
1





p
n


+

p

n
-
1






a

n
+
1





q
n


+

q

n
-
1




.





Therefore,





x
-



p
n


q
n




is
:
















x
-


p
n


q
n



=






a

n
+
1





p
n


+

p

n
-
1






a

n
+
1





q
n


+

q

n
-
1




-


p
n


q
n









=






a

n
+
1





p
n



q
n


+


p

n
-
1




q
n





q
n

(



a

n
+
1





q
n


+

q

n
-
1



)


-




a

n
+
1





p
n



q
n


+


p

n
-
1




q

n
-
1






q
n

(



a

n
+
1





q
n


+

q

n
-
1



)









=





p

n
-
1




q
n


-


p
n



q

n
-
1






q
n

(



a

n
+
1





q
n


+

q

n
-
1



)









Eq
.

18







Observe that pn−1qn−pnqn−1 (−1)n, which can be verified with n=2. Therefore,










x
-


p
n


q
n



=





p

n
-
1




q
n


-


p
n



q

n
-
1






q
n

(



a

n
+
1





q
n


+

q

n
-
1



)


=



(

-
1

)

n



q
n

(



a

n
+
1





q
n


+

q

n
-
1



)







Eq
.

19







Let q1′=an′ and qn=an′qn−1+qn−2. Then,










x
-


p
n


q
n



=




(

-
1

)

n



q
n

(



a

n
+
1





q
n


+

q

n
-
1



)


=



(

-
1

)

n



q
n



q

n
+
1










Eq
.

20







Notice that q increases steadily as n increases, so qn>qn−1. Similarly, qn+1′+qn+1 because qn′=an′qn−1+qn−2, and qn=anqn−1+qn−2, where the complete quotient an is always greater than the partial quotient an. Then, the following inequalities can be defined.










q

n
+
1





q

n
+
1


>


q
n



and



1

q

n
+
1







1

q

n
+
1



<


1

q
n


.





Eq
.

21









Finally
,












"\[LeftBracketingBar]"


x
-


p
n


q
n





"\[RightBracketingBar]"


=




(

-
1

)

n



q
n



q

n
+
1







1


q
n



q

n
+
1




<


1

q
n
2


.






Eq
.

22







Example 3. Let aN=[1, 2, 3, 1], which gives the following values for pn and qn.













p
0

=


a
0

=
1






q
0

=
1







p
1

=




a
1



a
0


+
1

=
3






q
1

=


a
1

=
2








p
2

=




a
2



p
1


+

p
0


=
10






q
2

=




a
2



q
1


+

q
0


=
7








p
3

=




a
3



p
2


+

p
1


=
13






q
3

=




a
3



q
2


+

q
1


=
9








Eq
.

23








and









[

1

,
TagBox[",", "NumberComma", Rule[SyntaxForm, "0"]]

2

,
TagBox[",", "NumberComma", Rule[SyntaxForm, "0"]]

3

,
TagBox[",", "NumberComma", Rule[SyntaxForm, "0"]]

1

]

=

1
+

1

2
+

1

3
+

1
1










Eq
.

24







which gives,














a
0


=

1
+

1
2



,











a
1


=

2
+

1
3



,





ξ
0

=

1
2









a
2


=

3
+

1
1



,





ξ
1

=

1
3









a
3


=


1

ξ
2


=
1


,





ξ
2

=

1
1








Eq
.

25







The distance between x and







p
2


q
2





is:















"\[LeftBracketingBar]"


x
-


p
2


q
2





"\[RightBracketingBar]"


=




"\[LeftBracketingBar]"






a
3




p
2


+

p
1





a
3




q
2


+

q
1



-


p
2


q
2





"\[RightBracketingBar]"








=




"\[LeftBracketingBar]"



13
9

-

10
7




"\[RightBracketingBar]"








=


1
63








Eq
.

26







The inequality in Lemma 1 can be verified, where







1


q
2



q
3



=



1

6

3




and



1

q
2
2



=


1

4

9


.
















"\[LeftBracketingBar]"


x
-


p
2


q
2





"\[RightBracketingBar]"


=


1
63



1


q
2



q
3



<

1

q
2
2







Eq
.

27







Theorem 4. If given α=a/b, we compute h=ab−1 mod p, where 0≤|a|≤N, 0<|b|≤p/(N+1) for N=|√{square root over (p/2)}|, then, since the EEA applied top and h computes all the convergents of h/p, a is set to be the i-th convergent ai/yi of h/p. We write this as a=H−1 (p, h).


Proof We can rearrange h=ab−1 mod p as a modular equation:






hb−a≡0 mod p  Eq. 28


The aim is to show that −k/b is a convergent of h/p by rearranging










"\[LeftBracketingBar]"


h
-

a
b




"\[RightBracketingBar]"




as



a
bp


=


h
p

-


k
b

·
hb

-
a





is congruent to 0 and therefore a multiple k of p. Thus,






hb−a=kp and a=hb−kp  Eq. 29


Then, dividing both sides by bp gives:










a
bp

=


h
p

-

k
b






Eq
.

30







By applying Lemma 1 we can prove that −k/b is a convergent of h/p by satisfying












"\[LeftBracketingBar]"



h

p
r


-

k
b




"\[RightBracketingBar]"


<

1

b
2






Eq
.

31







and it can be computed by the algorithm that computes all the convergents, the EEA. Then the value a/b can be obtained by EEA as ai/yi for the i such that |yi|≤N.


Definition 5. Let custom-characterh/p denote the set of all convergents of h/p such that:












h
/
p


=

{

a
/
b





"\[LeftBracketingBar]"







"\[LeftBracketingBar]"



h
p

-

k
b




"\[RightBracketingBar]"


<

1

b
2



,

k
=


(

bh
-
a

)

/
p





}





Eq
.

32







Lemma 2. If r=1, given α=a/b and a prime number p, where a, b, p are pairwise coprime, the Hensel code h of a computed as h=ab−1 mod p, then h is the zeroth term of the finite expansion that computes a.


Proof. Given α=a/b, we have ba0=a mod p, thus, the solution for a0=ab−1 mod p=h.


We compute Theorem 4 via a modified version of the BEA (MEEA), which is given in Algorithm 1.

















Algorithm 1: (MEEA) a = H−1 (p, h)



 Input: p, h;



 Output: a such that h = H (p, a)



 a0 = p, a1 = h; y0 =0, y1 =1; i = 1; N = └√{square root over (p/2)}┘



 while ai > N do



  q = └ai−1/ai┘;



  ai+1 = ai−1 − q · ai;



  yi+1 = yi−1 + q · yi;



  i = i + 1;



 end



  α = ((−1)i+1 · ai)/yi;



 Result: a










Example 4. Let h=97, p=241. We calculate a=H−1 (p, h) as follows:






a
0
p=241, a1=h=97, y0=0, y1=1, i=1.  Eq. 33


In the second iteration, we have:






q=└a
0
/a
1┘=2, a2=a1−q·a0=47, y2=y1−q·y0=2, i=2,  Eq. 34


and therefore:






q=└a
1
/a
2┘=2,a3=a2−q·a1=3, y3=y2−q·y1=5,i=3,  Eq. 35


and therefore:






c=(−1)i+1·ai, d=yi.  Eq. 36


The result is then given by a=c/d=3/5


Remark 2. Algorithm 1 computes all the convergents ai/yi of h/p until finding the first convergent that satisfies










"\[LeftBracketingBar]"


a
i



"\[RightBracketingBar]"



N

,




"\[LeftBracketingBar]"


y
i



"\[RightBracketingBar]"






"\[LeftBracketingBar]"


p

N
+
1




"\[RightBracketingBar]"



,

N
=





p
/
2




.






Theorem 5. Algorithm 1 runs in O (log N).


Proof Algorithm 1 is a modified EEA and this modification is solely on the setup of the inputs and the presentation of the results. Its complexity its truly defined by the while loop that computes all the convergents of hip which is bounded by N and the complexity of the bounded computation of all convergents by the EEA is 0 (log N).


2.3 Order-N Farey Fractions


There are some additional properties of the set of order-N Farey fractions that are worth discussing. In this section we provide some insights on the mapping between those fractions and their corresponding Hensel codes which will be relevant in understanding why this relationship can be useful for cryptography.


Recall that a prime number p encodes p order-N Farey fractions, each one with their unique corresponding integer from the set custom-characterp={0, . . . , p−1}. But what does N represent in terms of the mapping between order-N Farey fractions and their Hensel codes? We present some observations that we consider important in understanding this connection. We introduce Example 5 to illustrate that the order-N Farey fractions have 2N+1 integers and p−(2N+1) non-integer fractions. This metric is used in Theorem 8. Example 5 aims to assist the understanding that N determines the number of non-zero integer fractions allowed in the set, and by allowing zero, positive and negative integers, we have 2N+1.


Example 5. If p1=17, then N=└√17/2┘=2, and p1 encodes 17 order-N fractions with 17 integer Hensel codes, as we can see below:





0/1→0, 1/1→1, 2/1→2, −⅖→3, −¼→4, −⅔→5, ⅓→6, ⅕→7, −½→8, ½→9, −⅕→10, −⅓→11, ⅔→12, ¼→13, ⅖→14, − 2/1→15, − 1/1→16.  Eq. 37


We observe that in the set of order-N Farey fractions in (37), there are 2N+1=5 integers and p1−(2N+1)=17−5=12 non-integer fractions. If p2=13, then N=└√{square root over ( 13/2)}┘=2, and p2 encodes 13 order-N fractions with 13 integers, as we can see below:





0/1→0, 1/1→1, 2/1→2, −¼→3, −⅓→4, ⅔→5, −½→6, ½→7, −⅔→8, ⅓→9, ¼→10, − 2/1→11, − 1/1→12.  Eq. 38


Similarly, we observe that in the set of order-N Farey fractions in (38), there are 2N+1=5 integers and p2−(2N+1) non-integer fractions.


Notice in Example 5 that p1 and p2 share the same N, which indicates that their corresponding set of order-N Farey fractions have the same number of integers, with, however, different number of non-integer Farey fractions. Notice also that in Algorithm 1, we only compute the convergents while the numerator is greater than N for a given prime p and Hensel code h.


Lemma 3. Given an odd prime p, N=└√{square root over (p/2)}┘, and the Hensel codes hα, hβcustom-characterp where hα=H(p, α), hβ=H(p, β) and α and β are integers, for all hα≤N, it holds that H−1(p, hα)=α=hα and for all hβ>N it holds that H−1(p, hβ)=β≠hβ.


Proof. The modified EEA in Algorithm 1 is committed to compute all the convergents of a Hensel code h with respect to a prime p while ai>N for N=└√{square root over (p/2)}┘. Any Hensel code less than or equal to N will decode to a rational a=h since the setup of the algorithm defines a0=p and a1=h. Thus, it is clear that if h is not greater than N, then the iterations that computes the convergents are never calculated and the result is guaranteed to be an integer since we defined y1=1. With i=1, then it is guaranteed that










(

-
1

)


1
+
1


·

a
1



y
1


=

h
.





Conversely, if ai is indeed greater than N, this means that a convergent will be computed and a non-integer fraction will be output by the algorithm. Since Lemma 3 specifies that input order-N Farey fractions are integers, it is clear that whenever ai>N, the resulting fraction α is not equal to its corresponding Hensel code h.


Corollary 1. In all sets of order-N Farcy fractions, there are N+1 non-negative integers which the corresponding Hensel codes are equal to the original fractions.


Corollary 2. A Hensel code h decoded with two distinct primes p1 and p2 will only result in the same order-N Farey fraction α if α∈custom-character, α≤N and N=└√{square root over (p1/2)}┘=└√{square root over (p2/2)}┘.


Theorem 6. For all Hensel code h such that p−N≤h<p where N=└√{square root over (p2/2)}┘ it holds that the order-N Farey fraction α associated with h is a negative integer in {−N, . . . , −1}. We write H−1(p, h)=−x, x∈{1, . . . , N}.


Proof. The modified EEA in Algorithm 1 defines a0=p and a1=h. If N≤h≤p−N, then a1>N. In the first iteration, q is defined as q=└a0/a1┘, with for h≥p−N<p will be always equal to 1. Then, we compute a2 as a2=a0−qa1, which for h≥p−N<p it holds that a2≤N. Thus, there are no more iterations. Since q=1, y2 is computed as y2=y0+q·y1. Recall that in Algorithm 1, we start by defining y0=0 and y1=1. Thus, it holds that y2=1. Since by the end of the first iteration i=2, then ((−1)2+1·a2)/y2=−x, x∈{1, . . . , N}.


Theorem 7. For all prime p, there are p Hensel codes to encode p order-N (irreducible) Farey fractions where N=└√{square root over (p/2)}┘, which is composed by 2N+1 integers (fractions with one as the denominator) and p−(2N+1) non-integer fractions.


Proof. For all prime p and N=└√{square root over (p/2)}┘, Corollary 1 states that there are N+1 positive integer order-N Farey fractions in custom-characterN and Theorem 6 states that there are N negative integer Farey fractions in custom-characterN, which gives a total of 2N+1 integers order-N Farey fractions in custom-characterN. The non-integer Farey fractions are then given by p−(2N+1).


We are now ready to formally state a new definition and notation for the set of order-N Farey fractions with respect to a prime p.


Theorem 8. For all prime p and a/b∈custom-characterp, the set of order-N Farey fractions custom-characterp, where N is given by N=└√{square root over (p/2)}┘.










𝔽
p

=

{

and







gcd

(

a
,
b

)

=


gcd

(

a
,
p

)

=


gcd

(

b
,
p

)

=
1









a
b



is


the


first


convergent


in





h
/
p




such


that







0




"\[LeftBracketingBar]"

a


"\[RightBracketingBar]"



N

,

0
<



"\[LeftBracketingBar]"

b


"\[RightBracketingBar]"






p
/

(

N
+
1

)















Eq
.

39







Proof Lemma 3 states that all Hensel codes h≤N will decode to an order-N Farey fraction a=h and Theorem 6 states that all Hensel codes N≤h≥p−N<p will decode to an order-N Farey fraction α that is a negative integer in the set {−N, . . . , −1}. Thus, the first N+1 elements of custom-characterp are non-negative integers and the last N elements of custom-characterp are negative integers. Thus, it is clear that the last non-integer element of custom-characterp is the one which the corresponding Hensel code is h=p−(N+1). Given this Hensel code h, the setup of Algorithm 1 sets as initial values a0=p, a1=p−(N+1) and y0=0, y1=1. Then, in the first iteration, for all prime p that generates sets custom-characterp with at least one non-integer fraction (e.g., p≥5), the result of q=a0/a1=└p/p−(N+1)┐ will always be 1. Then,






a
2
=p−(p−(N+1)=N+1






y
2=0+1·1=1  Eq. 40


In the next iteration, we compute q, a3 and y3 as:






q=└a
1
/a
2┐=└(p−(N+1))/(N+1)┘






a
3
=a
1
−q·a
2=(P−(N+1)−└(p−(N+1))/(N+1)┘(N+1)






y
3
=y
1
+q·y
2=1+└(p−(N+1))/(N+1)┘·1=└p/(N+1)┘  Eq. 41


Since a3 is not greater than N, the algorithm stops and the denominator of the solution is given by y3.


2.4 Ring Isomorphism of Order-N Farey Fractions


The order-N Farey fractions custom-characterp), in which the elements are scoped as stated in Theorem 8, is a set equipped with two binary operations, addition and multiplication, where custom-characterp is associative and commutative under addition, and have an additive inverse and additive identity, and is associative and distributive under multiplication, and has a multiplicative identity. All non-zero elements of custom-characterp has a multiplicative inverse. Addition and multiplication in custom-characterp are defined as follows:





α+β∈custom-characterp=H−1(p,H(p,α+β))





αβ∈custom-characterp=H−1(p,H(p,αβ))  Eq. 42


Therefore, custom-characterp is a commutative ring. We want to show that custom-characterp is isomorphic with Zp. In Theorem 3 we showed that the function H uniquely and correctly maps elements of custom-characterp to elements of custom-characterp and in Theorem 4 we showed that the function H−1 uniquely and correctly maps elements of custom-characterp to elements of custom-characterp. Now we show the ring isomorphism between custom-characterp and custom-characterp by further examining addition and multiplication.


Lemma 4. For all α, β∈custom-characterp the following holds:






H(p,α+β)=H(p,α)+H(p,β)





α+β=H−1(p,H(p,α+β))  Eq. 43


Proof Given α=a/b, β=c/d∈custom-characterp, recall that each Hensel code h=ab−1 mod p can be rewritten as a diophantine equation so we can write the Hensel code of α, β, respectively, as:






h
α=(a−kαp)/b






h
β=(c−kβp)/d  Eq. 44


where kα, kβ are given by:






k
α=(a−bh)/p






k
β=(c−dh)/p  Eq. 45


Then, we can write the following:











H

(

p
,
α

)

+

H

(

p
,
β

)


=



a
b

+

c
d

-


pk
α

b

-


pk
β

d


=

h

α
+
β







Eq
.

46







We compute kα+β as:










k

α
+
β


=

ad
+
bc
-

bd



(




a
-


k
α


p


)

p

+


(

a
-


k
β


p


)

d


)

p







Eq
.

47







which allows us to obtain the numerator and denominator of a/b+c/d which is given by computing H−1 (p, α+β) and we verify that:











ad
+
bc

=


bdh

α
+
β


+


k

α
+
β



p






bd
=



(

ad
+
bc

)

-


k

α
+
β



p



h

α
+
β








Eq
.

48









Thus
,











H

-
1


(

p
,

h

α
+
β



)

=



(

ad
+
bc

)

/
bd

=

α
+
β






Eq
.

49







Lemma 5. For all α, β∈custom-characterp the following holds:






H(p,αβ)=H(p,α)H(p,β)





αβ=H−1(p,H(p,αβ))  Eq. 50


Proof. For α=a/b, β=c/d∈custom-characterp, once again we have:






H(p,α)=hα=(a−kαp)/b






H(p,β)=hβ=(c−kβp)/d  Eq. 51


where






k
α=(a−bh)/p






k
β=(c−dh)/p  Eq. 52


Then we can write the following:











H

(

p
,
α

)



H

(

p
,
β

)


=




(

a
-


k
α


p


)



(

c
-


k
β


p


)


bd

=

h
αβ






Eq
.

53







We compute kαβ as follows:










k
αβ

=


(

ac
-


(

a
-


k
α


p


)



(

c
-


k
β


p


)




p





Eq
.

54







which allows us to obtain the numerator and denominator of a/b·c/d which is given by computing H−1(p, αβ) and we verify that:










ac
=


bdh
αβ

+


k
αβ


p






bd
=


ac
-


k
αβ


p



h
αβ







Eq
.

55









Thus
,











H

-
1


(

p
,

h
αβ


)

=


ac
/
cd

=
αβ





Eq
.

56







We define the modulo p operation on elements of custom-character as follows:





α mod p=H−1(p,H(p,α)),αcustom-characterN.  Eq. 57


Example 6. Let p=83, and a/b=c/d=5/6∈custom-characterN. We show that the product:





5/6·5/6=25/36,  Eq. 58


corresponds to:










H

(

p
,


5
6

·

5
6



)

=


H

(

p
,

25
36


)

=


25
·


(
36
)


-
1



=


25
·
30

=

3

mod

83.








Eq
.

59







It is easy to verify that since








H

(

p
,

5
6


)

=

7

0


,




then:





70·70=3 mod 83.  Eq. 60


Example 7. Let p=83, and a/b=c/d=6/11∈custom-characterN. We show that the sum:





6/11+6/11=12/11,  Eq. 61


corresponds to:










H

(

p
,


6
11

+

6
11



)

=


H

(

p
,

12
11


)

=


12
·


(
11
)


-
1



=


12
·
68

=

69


mod

83.








Eq
.

62













H

(

p
,

6
11


)

=
76

,




It is easy to verify that since then:





76+76=69 mod 83.  Eq. 63


Example 8. What if the computations on elements in custom-characterp produce a very large result which is way far from custom-characterp? We show that the result, no matter what it is, is congruent modulo p. Let p=83, and a/b=5/9. Then, we show that the following holds:










H

(

83
,

5
/

9
·
5

/

9
·
5

/
9


)

=


H

(

p
,

5
9


)

·

H

(

p
,

5
9


)

·

H

(

p
,

5
9


)






Eq
.

64







where the computation with Hensel codes is reduced modulo 83. We see that:






H(83,5/9·5/9·5/9)=H(83,53/93)=53  Eq. 65


and since






H(83,5/9)=19  Eq. 66


then,





193=53 mod 83.  Eq. 67


Theorem 9. For any given prime p, there is a ring isomorphism between custom-characterp and custom-characterp.


Proof According to Theorems 3 and 4, the function H correctly and uniquely maps each member of custom-characterp to a member of custom-characterp as well as the function H−1 correctly and uniquely maps each member of custom-characterp to a member of custom-characterp. Lemmas 4 and 5 show that H and H−1 preserve this correspondence over addition and multiplication. Thus, there is a one-to-one and onto correspondence between custom-characterN and custom-characterp.


2.5 g-Adic Numbers


Definition 6. Let g be a positive integer which is written as the product of k distinct primes such that g=Πi=1kpi. A g-adic number has a unique expansion of the form x=a0+a1g+a2g2+ . . . , where a0≠0 and 0≤ai≤g. If we let a0+a1g+ . . . +aigi, then the expansion of a rational number a/b can be computed in terms of g as long as a, h and g are pairwise coprime.


Definition 7. g-adic number forward map Given k distinct prime numbers p1, . . . , pk, for k≥1, and a rational number a/b such that:










𝔽
g

=

{





gcd

(

a
,
b

)

=


gcd

(

a
,
g

)

=


g

c


d

(

b
,
g

)


=
1









a
/
b





g





"\[LeftBracketingBar]"


and


a
/
b


is


the


first


convergent


in





h
/
g




such


that










0




"\[LeftBracketingBar]"

a


"\[RightBracketingBar]"



N

,

0
<



"\[LeftBracketingBar]"

b


"\[RightBracketingBar]"






g
/

(

N
+
1

)














Eq
.

68










where












N
=




g
/
2





,

g
=




i
=
1

k


p
i



,





Eq
.

69







the k-digit Hensel code forward mapping is calculated as follows:













(


h
1

,


,

h
k


)

=



H
g

(


(


p
1

,


,

p
k


)

,

a
/
b


)







=


(


H

(


p
1

,

a
/
b


)

,


,

H

(


p
k

,

a
/
b


)


)








Eq
.

70







We write (h1, . . . , hk)=Hg((p1, . . . , pk), a/b).


Example 9. Given p1=241,p2=251, p3=281, a/b=3/5, the multiple direct Hensel code mapping is calculated as follows:













(


h
1

,


,

h
k


)

=



H
g

(


(


p
1

,


,

p
k


)

,

a
/
b


)







=



H
g

(


(


2

4

1

,

2

5

1

,

2

8

1


)

,

3
/
5


)







=


(

97
,

1

0

1

,

1

1

3


)








Eq
.

71







In order to define the g-adic number inverse map we introduce Lemma 6.


Lemma 6. Given an order-N Farey fraction a, k primes p1, . . . , pk and g=Πi=1kpi, the k-digit Hensel code (h1, . . . , hk)=Hg ((p1, pk), a) and the single digit Hensel code h H(g, α) are equivalent since they represent the same quantity a.


Proof. The single most relevant property in any prime p for being used to compute Hensel codes for order-N Farey fractions a is that p does not share any common divisor greater than 1 with any number less than p and therefore a modular multiplicative inverse of any number less than p and p is guaranteed to exist. Given k primes p1, . . . , pk, the k-digit Hensel code of a=a/b is computed as (H (p1, a), . . . , H(pk, a)). Since the Hensel code direct mapping requires a, h and each pi to be pairwise coprime and each Hensel code digit hi is less than each corresponding pi, it is guaranteed that gcd(a,g)=gcd(b, g)=1 for g=Πi=1kpi. If we compute (h1, . . . , hk)=Hg((p1, . . . , pk), α), we verify that:










i
=
1

κ



g

p
i




(



(

g

p
i


)


-
1



mod



p
i


)



h
i



mod


g


=

a


b

-
1




mod


g







and


thus








H
g

(


(


p
1

,


,


p
k


)

,

α

)




H

(

g
,
α

)

.





Example 10. Let p1=241, p2=251, p3=257, g=241·251·257=15546187 and α=3/5. We compute the 3-digit Hensel code for a as follows:





(97,101,52)=Hg((241,251,257),3/5)  Eq. 73


By computing the left-hand side of Eq. 72 we have:





(64507·119·97+61937·46·101+60491·83·52)=1293442759  Eq. 74


and





1293442759 mod g=1293442759 mod 15546187=3109238  Eq. 75


By computing the right-hand side of Eq. 72 we have:





3·5−1 mod 15546187=3·6218475 mod 15546187=3109238  Eq. 76


which is compliant with Eq. 72.


Definition 8. g-adic number inverse map Given k distinct odd prime numbers p1, . . . ,pk, and a k-digit Hensel code (h1, . . . , hk), the corresponding rational number a/b is calculated as follows:









z
=




i
=
1

k



g

p
i




(



(

g

p
i


)


-
1



mod



p
i


)



h
i



mod


g






Eq
.

77







where z is computed via the CRT, g=Πi=1kpi, and the result a/b is computed as







a
b

=



H

-
1


(

g
,
z

)

.





We write a/b=Hg−1((p1, . . . , pk), (h1, . . . , hk)).


Example 11. Given p1=241,p2=251,p3=281 and the Hensel codes h1=97, h2=101, h3=113, we calculate the corresponding rational number a/b as follows:












z
=





i
=
1

2



g

p
i




(



(

g

p
i


)


-
1




mod



p
i


)



h
i



mod


g








=

6799189







Eq
.

78








and









a
/
b

=



H

-
1


(

g
,
z

)







=



H

-
1


(


1

6

9

9

7

9

71

,
6799189

)







=


3
/
5








Theorem 10. Let (p1, . . . , pk) be k distinct primes, and N=└√{square root over (g/2)}┘. A k-digit Hensel code encoded in terms of (p1, . . . , pk) is equivalent to a single digit Hensel code encoded in terms of g.


Proof Given k primes (p1, . . . , pk), N=└√{square root over (g/2)}┘, g=Πi=1kpi, a rational number a/b where a, b, g are pairwise coprimes and a k-digit Hensel code (h1, . . . , hk)=Hg((p1, . . . , pk), a/b), it holds that:












i
=
1

k



g

p
i




(



(

g

p
i


)


-
1




mod



p
i


)



h
i



mod



g
.






Eq
.

80







It is easy to see that (80) holds if we have a single prime and g=p. Then mod








g

p
i




(



(

g

p
i


)


-
1



mod



p
i


)


=
1




and we gave h mod g left, since we have a single code for a single prime. Thus, ab−1 mod g. Another way to see this equivalence is by inspecting the g-adic number inverse map in Definition 8. The first of decoding a k-digit Hensel code is to compute z in Eq. 77. Then, z is decoded as a single Hensel code in terms of g and it is clear that:







H

(

g
,

a
/
b


)

=




i
=
1

k



g

p
i




(



(

g

p
i


)


-
1




mod



p
i


)



h
i



mod



g
.







Example 12. Let k=4, (p1, p2,p3,p4)=(17, 23, 37, 41), g=Πi=1kpi=593147 and a/b=25/11. The 4-digit Hensel code for 25/11 is given by:






H
g((17,23,37,41),25/11)=(10,19,9,6).  Eq. 82


In order to decode (10, 19, 9, 6) back to a/b, according to Definition 8, the first step is to compute z via CRT:






z=34891·5·10+25789·4·19+16031·26·9+14467·34·6=323537,  Eq. 83


and we check that:










H

(

g
,

a
b


)

=


H

(


5

9

3

1

4

7

,


2

5


1

1



)

=

3

2

3

5

3


7
.







Eq
.

84







Theorem 11. A rational number a/b encoded with k distinct primes (p1, . . . , pk) must result in k distinct Hensel digits if a/b is not a positive integer.


Proof Since a, b and pi, for i=1 k are all pairwise coprime, the only way to have non-distinct Hensel digits in (ab−1 mod pi, ab−1 mod pk) is if 0≤a≤pi (for all i) and b=1, which indicates that a/b is a positive integer. If a≥0 and b>0, b≠1, then the modular multiplicative inverse of b with respect to pi is unique, which will result in k distinct Hensel digits. If a<0 and b=1, which indicates that a/b is a negative integer, the modular additive inverse of a with respect to pi is also unique, resulting in k distinct Hensel digits.


3. Encrypting Rational Numbers


The theory of p-adic numbers is sometimes referred as a theory of representation, mostly for its ability of consistently replacing the arithmetic over rational numbers by the arithmetic over the integers. In some applications, critical data are often represented as fractions, as it is the case of machine learning, where some data need to be normalized and then taken the standard deviation, production values within, say, 0 and 1. In this section we want to demonstrate that some well-known cryptosystems can be slightly modified to include rational numbers in the set of its inputs without adding extra variables or compromising existing homomorphic properties, as it is the case of RSA.


3.1 RSA with Rational Numbers


The RSA clyptosystem can be summarized as follows: given a public key e and two secret prime numbers p and q, a public key n is computed such that n=pq and the private keys ϕ(n) and d are computed such that ϕ(n) (p−1)(q−1) and d=e−1 mod ϕ(n), i.e., ed=1 mod ϕ(n). Given a message in, a ciphertext c is computed such that c=me mod n. The message m can be retrieved from c such that m=cd mod n. This is known as the “naive” RSA signatures, which is sufficient for this particular discussion, since we are addressing an extension of RSA's utility without affecting its security. For the secure versions of RSA discussed by Katz and Lindell, such as RSA PKCS and RSA-OAEP, we propose the same basic approach that will be discussed next, that, to consider the message m a rational number and replace it by its corresponding Hensel code h.


RSA operates over the integers. If one wants to use RSA to encrypt any data that is not in integer form, then a mapping from any other format to integer form is required. We show that Hensel codes can be used to solve this problem without compromising RSA properties.


Definition 9. Hensel codes with single existing prime Let custom-characterp be a set of order-N Farey fractions. Then, p is chosen to encode α=a/b∈custom-characterp where N=└√{square root over (p/2)}┘. The Hensel encoding is given by h=H(p, a/h). The ciphertext c is computed as c=he mod n. This scheme preserves the multiplicative homomorphism in the original textbook definition of RSA since p is a factor of n.


Remark 3. According to Definition 9, the message space is reduced from {0, . . . , n−1} to {0, . . . , p−1}.


Remark 4. Because p is needed to encode m∈custom-character as h∈custom-characterp, the encryption scheme is no longer a public-key one, instead, it is a private-key encryption scheme.


Example 13. Let e=17,p=211. q=199, n=41989, φ(n)=41580 and d=22013. Let a=9/7 be the fraction we want to encrypt. We proceed as follows:






h=H(p,α)=H(211,9/7)=152






c=h
e mod n=15217 mod 41989=35864  Eq. 85


Decryption is computed as follows:






h=c
d mod n=3586422013 mod n=152





α=H−1(p,h)=9/7  Eq. 86


Definition 10. Hensel codes with public modulus Let custom-characterN be a set of order-N Farey fractions for any given N=└√{square root over (n/2)}┘. We use n=pq to encode α=a/b∈custom-characterN so the Hensel encoding is given by h=ab−1 mod n. The ciphertext c is computed as c=he mod n.


Remark 5. According to Definition 10, the message space size is exactly the same as the standard RSA configuration, that is, |{0, . . . , n−1}∥=n.


Remark 6. By using n to encode m∈custom-character as h∈custom-charactern, the encryption scheme remains a public-key encryption scheme.


Example 14. Let e=17, p=211, q=199, n=41989, ϕ(n)=41580 and d=22013. Let a=9/7 be the fraction we want to encrypt. We proceed as follows:






h=H(n,a)=H(41989,9/7)=23995






c=h
e mod n=2399517 mod 41989=15608  Eq. 87


Decryption is computed as follows:






h=c
d mod n=1560822013 mod n=23995






a=H
−1(n,h)=9/7  Eq. 88


Remark 7. The Hensel code function is homomorphic with respect to addition and multiplication. The RSA function is homomorphic with respect to multiplication. Since both functions are homomorphic with respect to multiplication, adding the Hensel code step to the RSA implementation will preserve the multiplicative homomorphism of RSA.


Example 15. Let e=23, p=227, q=173, n=39271, ϕ(n)=38872 and d=18591. Let a1=4/5, a2=7/6, and n be used to compute the Hensel code of a1 and a2. We have h1=H(n, a1)=7855 and h2=H(n, a2)=32727. We compute c1 and c2 as c1=h1 mod n=2415 and c2=h2 mod n=20018. Let c3 be the product of c1 and c2 such that c3=c1c2 mod n=869. We compute h3=c3d mod n=2619 and a3=H−1 (n, h3)=14/15. We then verify that a1a2 4/5·7/6=14/15=a3.


The methods introduced are particularly interesting if a given encryption scheme is originally designed to work over the integers and is homomorphic with respect to addition and/or multiplication since they allow such encryption scheme to operate also with rational numbers while preserving any existing homomorphism.


4. Adding Randomness to Deterministic Algorithms


In 1984, Goldwasser and Micali introduced a new model of encryption, that is, the probabilistic (or randomized) encryption while remarking its superiority in computational complexity in comparison with its deterministic counterpart. All techniques used to address this problem result in some form of ciphertext expansion.


4.1 Randomized RSA


Once again, we use the RSA cryptosystem illustrate utilities provided by Hensel codes, this time, randomization. Our goal is to modify the RSA scheme in order to add randomization without affecting its multiplicative homomorphism. We propose two versions, one that is a private-key and another that is a public-key encryption scheme.


Definition 11. Let the randomized private-key RSA be defined as follows: given e, p, q, ϕ(n), d from the standard RSA configuration,

    • Enc is a probabilistic-polynomial time algorithm that, in order to encrypt a message m∈custom-characterp, choose a uniform s∈{1, . . . , q−1} compute Hg−1((p, q), (m, s)), then h=H(n, a), so the ciphertext c is given by c=he mod n.
    • Dec is a deterministic-polynomial time algorithm that, given a ciphertext c, we compute a=H−1 (n, h) in order to retrieve in as m=H(p, a).


Example 16. Let e=23,p=227, q=173, n=39271, ϕ(n)=38872, d=18591, the message m=16, and the random number s=179. We compute a, h and c as follows: First, we compute a:





α=Hg−1(227,173),(16,179))=123/107,  Eq. 89


then we compute h:






h=123·107−1 mod 39271=123·19452 mod 39271=36336.  Eq. 90


The ciphertext c is computed as:






c=h
e mod n=3633623 mod 39271=20893.  Eq. 91


Decryption is computed as follows: we first recover h:






h=c
d mod n=2089318591 mod 39271=36336,  Eq. 92


then we compute a:






a=H
−1(n,h)=H−1(39271,36336)=123/107,  Eq. 93


so we can finally recover m:






m=ab
−1 mod p=123·107−1 mod 39271=123·157 mod 227=16.  Eq. 94


Remark 8. According to Theorem 10, we could simplify the encryption function to be:






h=c(q−1 mod p)p(p−1 mod q)s






c=h
e mod n  Eq. 95


however, in order to keep notation and strategy consistent with the remainder of this work, which include constructions with more than two primes, we favor generalization and express the computations in terms of single and multiple Hensel codes.


Remark 9. The randomization in Definition 11 is given by s. Ifs is uniformly random in the set {1, . . . , q−1}, then there will be q−1 possible values for h and c for every message m that is encrypted.


Example 17. Let p=227, q=173, n=39271. If the message m=23 and s=202, a=Hg−1((p,q), (m, s))=73/92 and h=H(n, a)=17502, thus c=he mod n=20747. If the same message is accompanied of s=234, a=Hg−1((p, q), (m, s))=67/72, h=H(n,a)=19091, hence c=he mod n=6900.


Definition 12. Let the randomized public-key RSA be defined as follows: given e, p, q, n, ϕ(n), d from the standard RSA configuration, and let two additional public primes x, y, xy<n be considered such that:

    • Enc is a probabilistic-polynomial time algorithm that, in order to encrypt a message m∈custom-characterx, choose a uniform s∈{1 . . . , y−1} compute α=Hg−l((x,y),(m,s)), then h=H(n, a), so the ciphertext c is given by c=he mod xyn.
    • Dec is a deterministic-polynomial time algorithm such that, given a ciphertext c, we compute a=H(n, h) in order to retrieve m as m=H(x, a).


Remark 10. Since x, y, n are public, only public information is required for encrypting, thus the proposed randomized RSA encryption scheme remains a public-key one and multiplicative homomorphic. If one is not interested in homomorphism, the encryption can be computed as c=he mod n.


Remark 11. Similar to what we discussed in Section 3, we are adding Hensel codes to the RSA recipe as a tool of representation, meaning, we are transforming a deterministic encryption scheme into a probabilistic one by representing a message m together with a random s as a 2-digit Hensel code s), which is then represented as a Farey fraction a. As we discussed in Section 2.5, there is a unique Farey fraction α for each k-digit Hensel code with respect to k primes.


Hardware Implementation for a p-Adie Number Enhanced RSA Cryptosystem Embodiment (FIG. 1)



FIG. 1 is a block diagram 100 of the hardware implementation for a p-adic Number Enhanced RSA Cryptosystem Embodiment. The hardware diagram 100 shown in FIG. 1 applies equally well to embodiments that encrypt rational numbers using p-adic numbers as to embodiments that add randomness using p-adic numbers. A source device 102 is connected over an electronic network/bus connection 106 to a destination device 104. In the embodiment shown in FIG. 1, the source device 102 acts as the source of the encrypted messages of the RSA cryptosystem and the source device 102 sends the encrypted data 108 over the network/bus connection 106 to the destination device 104. The destination device 104 acts as a destination for the encrypted data 108 received from the network/bus connection 106. Generally, communications, including concealed/encrypted communications, are bi-directional such that the source 102 and destination 104 devices may change roles as the encrypted data 108 source and the encrypted data 108 destination as is necessary to accommodate the transfer of data back and forth between the computing devices 102, 104. Additionally, while the computing devices 102, 104 are depicted as separate devices in FIG. 1, the functionality of the source device 102 and the destination device 104 may be shared on a single computing system/device or among two computing devices as it is often desirable to conceal data when transferring data between components of a single device.


Further, as shown in FIG. 1, the source device 102 appears to be a laptop computer and the destination device 104 appears to be a tablet device. Generally, any computing device capable of communication over any form of electronic network or bus communication platform 106 may be one or both of the source 102 and destination 104 computing devices. Additionally, the source 102 and destination 104 computing devices may actually be the same physical computing device communicating over an internal bus connection 106 with itself, but still desiring to encrypt transferred data to ensure that an attacker cannot monitor the internal communications bus 106 to obtain sensitive data communications in an unencrypted format.


Various embodiments may implement the network/bus communications channel 106 using any communications channel 106 capable of transferring electronic data between the source 102 and destination 104 computing devices. For instance, the network/bus communication connection 106 may be an Internet connection routed over one or more different communications channels during transmission between the source 102 and destination 104 devices. Likewise, the network/bus communication connection 106 may be an internal communications bus of a computing device, or even the internal bus of a processing or memory storage Integrated Circuit (IC) chip, such as a memory chip or a Central Processing Unit (CPU) chip. The network/bus communication channel 106 may utilize any medium capable of transmitting electronic data communications, including, but not limited to: wired communications, wireless electro-magnetic communications, fiber-optic cable communications, light/laser communications, sonic/sound communications, etc., and any combination thereof of the various communication channels.


The various embodiments may provide the control and management functions detailed herein via an application operating on the source 102 and/or destination 104 computing devices. The source 102 and/or destination 104 computing devices may each be a computer or computer system, or any other electronic devices device capable of performing the communications and computations of an embodiment. The source 102 and/or destination 104 devices may include, but are not limited to: a general-purpose computer, a laptop/portable computer, a tablet device, a smart phone, an industrial control computer, a data storage system controller, a CPU, a Graphical Processing Unit (GPU), an Application Specific Integrated Circuit (ASI), and/or a Field Programmable Gate Array (FPGA). Notably, the first 102 and/or second 104 computing devices may be the storage controller of a data storage media (e.g., the controller for a hard disk drive) such that data delivered to/from the data storage media is always encrypted so as to limit the ability of an attacker to ever have access to unencrypted data. Embodiments may be provided as a computer program product which may include a computer-readable, or machine-readable, medium having stored thereon instructions which may be used to program/operate a computer (or other electronic devices) or computer system to perform a process or processes in accordance with the various embodiments. The computer-readable medium may include, but is not limited to, hard disk drives, floppy diskettes, optical disks, Compact Disc Read-Only Memories (CD-ROMs), Digital Versatile Disc ROMS (DVD-ROMs), Universal Serial Bus (USB) memory sticks, magneto-optical disks, ROMs, random access memories (RAMs), Erasable Programmable ROMs (EPROMs), Electrically Erasable Programmable ROMs (EEPROMs), magnetic optical cards, flash memory, or other types of media/machine-readable medium suitable for storing electronic instructions. The computer program instructions may reside and operate on a single computer/electronic device or various portions may be spread over multiple computers/devices that comprise a computer system. Moreover, embodiments may also be downloaded as a computer program product, wherein the program may be transferred from a emote computer to a requesting computer by way of data signals embodied in a carrier wave or other propagation medium via a communication link (e.g., a modem or network connection, including both wired/cabled and wireless connections).


Operational Flow Chart for Concealing and Recovery for an Embodiment (FIG. 2)


FIG. 2 is a flow chart 200 of a p-adic number enhanced RSA cryptosystem embodiment for encrypting rational numbers. It should be noted that an RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n=pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1)(q−1) and d=e−1 mod ϕ(n). At process 206, the source computing device 202 encodes a rational number a using p-adic based integer Hensel encoding as a function of a Hensel encoding value v and the rational number a to obtain integer Hensel code h. Rational number a is comprised of a fraction a/b with numerator a and denominator b, where the numerator a, denominator b, and the Hensel encoding value v are pairwise coprime, and where an absolute value of said numerator a and denominator h are less than said Hensel encoding value v. Various embodiments may use the secret prime number p for the Hensel encoding value v, which necessitates that the RSA cryptosystem be a private-key encryption system since the secret prime number p is needed to encode and decode the Hensel code and secret prime number p is no longer secret. Alternatively, various embodiments may use public key n for the Hensel encoding value v, which allows the RSA cryptosystem to remain a public-key encryption system since public key n is already a public value.


At process 208, the source computing device 202 encrypts the integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c. At process 210, the source computing device 202 sends the ciphertext c to the destination computing device 204. At process 212, the destination computing device 204 decrypts ciphertext c using RSA decryption processes to obtain the integer Hensel code h. At process 214, the destination computing device 204 decodes integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of the Hensel encoding value v and the Hensel code h to obtain the corresponding rational number a. It is also worth noting that since the p-adic are additive and multiplicative homomorphic, the multiplicative homomorphism of the RSA cryptosystem is maintained.


Operational Flow Chart for Concealing and Recovery for an Embodiment (FIG. 3)


FIG. 3 is a flow chart 300 of a p-adic number enhanced RSA cryptosystem embodiment for randomizing ciphertext values. Again, it should be noted that an RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n=pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1) (q−1) and d=e−1 mod ϕ(n). At process 306, the source computing device 302 computes a g-adic number inverse Hg−1 as a function of a first prime number x and a second prime number y acting as prime numbers for the g-adic number inverse Hg−1, and the message value in and a random number s acting as Hensel codes for the g-adic number inverse Hg−1 to obtain rational number a, where the random number s is changed for each subsequent encryption operation and the rational number a comprised of a fraction a/b with numerator a and denominator b, and such that the rational number a is different for each different random number s in the subsequent encryption operations for the message value 112 that does not change so as to randomize a ciphertext value c based on the rational number a that changes as the random number s is changed even when the message value in remains constant. For various embodiments, the first prime number x is the secret prime number p and the second prime number y is the secret prime number q. When using the secret prime numbers p, q, the RSA cryptosystem is necessarily a private-key encryption system since the secret prime number p is needed to recover the message value m, but the multiplicative homomorphism of the RSA cryptosystem is maintained without any additional operations being require. For other embodiments, the first and second prime numbers x, y are additional prime numbers separate from the secret prime numbers p, q, so the RAS cryptosystem remains a public-key encryption system, but the multiplicative homomorphism may be lost without a change to the RSA cryptosystem operations. To retain the multiplicative homomorphism of the RSA cryptosystem the RSA encryption processes should be modified such that ciphertext c is calculated as c=he mod xyn rather than c=he mod n.


At process 308, the source computing device 302 encodes the rational number a using p-adic based integer Hensel encoding as a function of the public key n and the rational number a to obtain integer Hensel code h. At process 310, the source computing device 302 Encrypts the integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c. At process 312, the source computing device 302 sends the ciphertext c to the destination computing device 304. At process 314, the destination computing device decrypts ciphertext c using RSA decryption processes to obtain the integer Hensel code h. At process 316, the destination computing device 304 decodes the integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of the public key n and the Hensel code h to obtain the corresponding rational number a. At process 318, the destination computing system 304 encodes the rational number a using p-adic based integer Hensel encoding as a function of the first prime number x and the rational number a to obtain message value m that is a Hensel code of the rational number a.


The foregoing description of the invention has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed, and other modifications and variations may be possible in light of the above teachings. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application to thereby enable others skilled in the art to best utilize the invention in various embodiments and various modifications as are suited to the particular use contemplated.

Claims
  • 1. A method for encrypting a rational number a with a RSA (Rivest-Shamir-Adleman) cryptosystem for communication between a source device and a destination device wherein said RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n=pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1)(q−1) and d=e−1 mod ϕ(n), the method comprising: encoding by said source device said rational number a using p-adic based integer Hensel encoding as a function of a Hensel encoding value v and said rational number a to obtain integer Hensel code h, where said rational number a is comprised of a fraction a/b with numerator a and denominator h, where said numerator a, denominator h, and Hensel encoding value v are pairwise coprime, and where an absolute value of said numerator a and denominator h are less than said Hensel encoding value v;encrypting by said source device said integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c;sending by said source device said ciphertext c to said destination device;decrypting by said destination device said ciphertext c using RSA decryption processes to obtain said integer Hensel code h; anddecoding by said destination device said integer Hensel code h using an Extended Euclidean Algorithm (PEA) as a function of said Hensel encoding value v and said Hensel code h to obtain said corresponding rational number a.
  • 2. The method of claim 1 wherein said Hensel encoding value v is said secret prime number p, such that said RSA cryptosystem is a private-key encryption system since secret prime number p is needed to encode and decode said Hensel code h.
  • 3. The method of claim 1 wherein said Hensel encoding value v is said public key n, such that said RSA cryptosystem remains a public-key encryption system since public key 17 needed to encode and decode said Hensel code h is already public.
  • 4. The method of claim 1 wherein multiplicative homomorphism of said RSA cryptosystem is retained as Hensel encoding is also multiplicative homomorphic.
  • 5. A method for randomizing ciphertexts of a message value m for a RSA (Rivest-Shamir-Adleman) cryptosystem for communication between a source device and a destination device wherein said RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1)(q−1) and d e−1 mod ϕ(n), the method comprising: computing by said source device a g-adic number inverse Hg−1 as a function of a first prime number x and a second prime number y acting as prime numbers for said g-adic number inverse Hg−1, and said message value in and a random number s acting as Hensel codes for said g-adic number inverse Hg−1 to obtain rational number a, where said random number s is changed for each subsequent encryption operation and said rational number a is comprised of a fraction a/h with numerator a and denominator b, and such that said rational number a is different for each different random number s in said subsequent encryption operations for said message value in that does not change so as to randomize a ciphertext value c based on said rational number a that changes as said random number s is changed even when said message value m remains constant;encoding by said source device said rational number a using p-adic based integer Hensel encoding as a function of said public key n and said rational number a to obtain integer Hensel code h;encrypting by said source device said integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c;sending by said source device said ciphertext c to said destination device;decrypting by said destination device said ciphertext c using RSA decryption processes to obtain said integer Hensel code h;decoding by said destination device said integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of said public key n and said Hensel code h to obtain said corresponding rational number a; andencoding by said destination device said rational number a using p-adic based integer Hensel encoding as a function of said first prime number x and said rational number a to obtain message value in that is a Hensel code of said rational number a.
  • 6. The method of claim 5 wherein said first prime number x is said secret prime number p and said second prime number y is said secret prime number q, such that said RSA cryptosystem is a private-key encryption system since secret prime number p is needed to recover message value in, and such that multiplicative homomorphism of said RSA cryptosystem is retained.
  • 7. The method of claim 5 wherein said first prime number x and said second prime number y are additional prime numbers to said secret prime numbers p and q, such that said RSA cryptosystem remains a public-key encryption system since only public values are needed to recover message value in.
  • 8. The method of claim 7 wherein said RSA encryption processes is modified such that ciphertext c is calculated as c=he mod xyn rather than c=he mod 77 so as to retain multiplicative homomorphism of said RSA cryptosystem.
  • 9. An RSA (Rivest-Shamir-Adleman) cryptosystem that encrypts a rational number a for communication between a source device and a destination device wherein said RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n=pq, and the private keys ϕ(n) and d that are computed as ϕ(n) (p−1) (q−1) and d=e−1 mod ϕ(n), the RSA cryptosystem comprising: said source device, wherein said source device further comprises: a Hensel code encoding subsystem that encodes device said rational number a using p-adic based integer Hensel encoding as a function of a Hensel encoding value v and said rational number a to obtain integer Hensel code h, where said rational number a is comprised of a fraction a/b with numerator a and denominator b, where said numerator a, denominator b, and Hensel encoding value v are pairwise coprime, and where an absolute value of said numerator a and denominator b are less than said Hensel encoding value v;an encryption subsystem that encrypts said integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c; anda send subsystem that sends said ciphertext c to said destination device; andsaid destination device, wherein said destination device further comprises: a decryption subsystem that decrypts said ciphertext c using RSA decryption processes to obtain said integer Hensel code h; anda Hensel code decode subsystem that decodes said integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of said Hensel encoding value v and said Hensel code h to obtain said corresponding rational number a.
  • 10. The RSA cryptosystem of claim 9 wherein said Hensel encoding value v is said secret prime number p, such that said RSA cryptosystem is a private-key encryption system since secret prime number p is needed to encode and decode said Hensel code h.
  • 11. The RSA cryptosystem of claim 1 wherein said Hensel encoding value v is said public key 17, such that said RSA cryptosystem remains a public-key encryption system since public key n needed to encode and decode said Hensel code h is already public.
  • 12. The RSA cryptosystem of claim 1 wherein multiplicative homomorphism of said RSA cryptosystem is retained as Hensel encoding is also multiplicative homomorphic.
  • 13. An RSA (Rivest-Shamir-Adleman) cryptosystem that for randomizes ciphertexts of a message value in for communication between a source device and a destination device wherein said RSA cryptosystem has a public key e, two secret prime numbers p and q, a public key n such that n=pq, and the private keys ϕ(n) and d that are computed as ϕ(n)=(p−1)(q−1) and d=e−1 mod ϕ(n), the RSA cryptosystem comprising: said source device, wherein said source device further comprises: a g-adic number inverse subsystem that computes a g-adic number inverse Hg−1 as a function of a first prime number x and a second prime number y acting as prime numbers for said g-adic number inverse Hg−1, and said message value in and a random number s acting as Hensel codes for said g-adic number inverse Hg−1 to obtain rational number a, where said random number s is changed for each subsequent encryption operation and said rational number a is comprised of a fraction a/b with numerator a and denominator b, and such that rational number a is different for each different random number s in said subsequent encryption operations for said message value in that does not change so as to randomize a ciphertext value c based on said rational number a that changes as said random number s is changed even when said message value in remains constant;a Hensel code encoding subsystem that encodes said rational number a using p-adic based integer Hensel encoding as a function of said public key n and said rational number a to obtain integer Hensel code h;an encryption subsystem that encrypts said integer Hensel code h using RSA cryptosystem encryption processes to obtain ciphertext c; anda send subsystem that sends said ciphertext c to said destination device; andsaid destination device, wherein said destination device further comprises: a decryption subsystem that decrypts said ciphertext c using RSA decryption processes to obtain said integer Hensel code h;a Hensel code decode subsystem that decodes said integer Hensel code h using an Extended Euclidean Algorithm (EEA) as a function of said public key n and said Hensel code h to obtain said corresponding rational number a; anda Hensel code message recovery subsystem that encodes said rational number a using p-adic based integer Hensel encoding as a function of said first prime number x and said rational number a to obtain message value in that is a Hensel code of said rational number a.
  • 14. The RSA cryptosystem of claim 13 wherein said first prime number x is said secret prime number p and said second prime number y is said secret prime number q, such that said RSA cryptosystem is a private-key encryption system since secret prime number p is needed to recover message value m, and such that multiplicative homomorphism of said RSA cryptosystem is retained.
  • 15. The RSA cryptosystem of claim 13 wherein said first prime number x and said second prime number y are additional prime numbers to said secret prime numbers p and q, such that said RSA cryptosystem remains a public-key encryption system since only public values are needed to recover message value in.
  • 16. The method of claim 15 wherein said RSA encryption processes are modified such that ciphertext c is calculated as c=he mod xyn rather than c=he mod n so as to retain multiplicative homomorphism of said RSA cryptosystem.
CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of international application serial number PCT/U.S. Pat. No. 21,150,988, filed Sep. 17, 2021, which is based upon and claims the benefit of U.S. provisional application Ser. No. 63/079,676, filed Sep. 17, 2020, entitled “p-adic Numbers and Applications to Cryptography,” the contents of which applications are specifically incorporated by reference herein for all that they disclose and teach.

Provisional Applications (1)
Number Date Country
63079676 Sep 2020 US
Continuations (1)
Number Date Country
Parent PCT/US21/50988 Sep 2021 US
Child 17891926 US