Next Article in Journal
Leveraging Machine Learning Techniques to Predict Cardiovascular Heart Disease
Previous Article in Journal
DEEPEIA: Conceptualizing a Generative Deep Learning Foreign Market Recommender for SMEs
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Secret Cryptographic Key Sharing Through the Integer Partition Function

by
Daniel Fernandes da Nobrega
1,
Marcio Luís Munhoz Amorim
1,
Sérgio F. Lopes
2,3,
João Paulo Carmo
1,
José A. Afonso
2,3,* and
Mario Gazziro
4
1
Group of Metamaterials Microwaves and Optics (GMeta), Department of Electrical Engineering (SEL), University of São Paulo (USP), Avenida Trabalhador São-Carlense, Nr. 400, Parque Industrial Arnold Schimidt, São Carlos 13566-590, Brazil
2
CMEMS-UMinho, University of Minho, 4804-533 Guimarães, Portugal
3
LABBELS—Associate Laboratory, University of Minho, 4710-057 Braga, Portugal
4
Information Engineering Group, Department of Engineering and Social Sciences (CECS), Federal University of ABC (UFABC), Av. dos Estados, 5001, Santo André 09210-580, Brazil
*
Author to whom correspondence should be addressed.
Information 2025, 16(8), 637; https://doi.org/10.3390/info16080637
Submission received: 24 June 2025 / Revised: 22 July 2025 / Accepted: 24 July 2025 / Published: 25 July 2025

Abstract

Secret key exchange is a necessary function for modern cryptography. The integer partition function is a mathematical function that arises from number theory. New methods for computing the integer partition function were developed and evaluated in the context of this paper, as well as new methods for using the integer partition function in a secret key exchange. The methods were categorized into single-variable and multiple-variable methods. The single-variable methods were found to be insecure. The multiple-variable methods were shown to be vulnerable to attacks that solve a linear system. These methods were implemented in microcontrollers using the C++ programming language. Experiments were conducted to evaluate the security of the developed methods in a wireless key exchange scenario. It was concluded that the security provided by the key exchange of the developed methods was low.

Graphical Abstract

1. Introduction

One of the challenges faced by the information sector is the secure transmission of data. Cryptography enables secure communications in various applications, such as data transmission over the Internet. It becomes necessary when information needs to be exchanged between two entities without third parties being able to correctly interpret the messages, even if they have access to the transmitted data. Depending on the system, several cryptographic functions may be required, such as encryption, decryption, key sharing, pseudo-random number generation, digital signature, etc. Virtually all modern digital communication protocols, including TCP/IP, Wi-Fi, and Bluetooth protocols, have some encryption mechanism.
Cryptography is a telecommunications area that is expanding rapidly every day. With the goal of guaranteeing authenticity and privacy, new methods have been proposed as alternatives to existing protocols and systems. This advancement has been motivated not only by the demand for greater security but also by the latent threat of vulnerabilities in the most widely used protocols. Secret key exchange methods are a fundamental part of modern cryptography, providing the basis mainly for the paradigm of public- and private-key encryption. However, the application of these methods in an insecure channel is a cryptographic problem where current implemented solutions may prove to be insufficient in the future.
The security of the Diffie–Hellman key exchange is based on the difficulty of the mathematical problem of the discrete logarithm [1], which assumes that it is difficult to find the exponent to which we raise a certain number, once the calculation has been carried out, within a finite group. It is, therefore, assumed that reversing the operation is too costly or impractical for an attacker targeting the communication. However, as time passes, new methods of performing this inverse operation continue to emerge. Notably, Shor’s algorithm [2] can, in theory, factorize a large numbers efficiently using quantum computing techniques. Although this is still an area in its infancy, the assumption that the inversion of the exponentiation operation is difficult may be challenged in the coming decades with the advancement of quantum computing.
This paper focuses on sharing secret keys through a channel that can be accessed by third parties using novel methods based on integer partition. Experiments are also presented to analyze the cryptographic capabilities of the proposed scheme and its resistance to attacks. One of the main contributions of this paper is the proposal and evaluation of a new alternative to the Diffie–Hellman key exchange. To this end, we use integer partition functions, which have properties that make it possible to perform the cryptographic function of the key exchange. This paper also presents new formulas for obtaining the values of the integer partition functions, which are necessary in the practical application of the new key exchange alternative. The experimental results obtained from the implementation of these methods are presented and analyzed as a proof of concept of their viability for low-complexity cryptographic applications. Finally, ways to expand the scope of these methods to more robust applications are also proposed as directions for future work.

2. Literature Review

Cryptography consists of the use of practices and principles for transmitting information without this information being accessible to third parties, that is, in a way that only the transmitter (or sender) and the receiver (or recipient) of a message can correctly interpret its content [3]. This way, cryptography aims to protect private information from being known by potential malicious users or attackers. Although useful for protecting saved or transmitted data, this protective capacity of cryptography can be quite fragile. Therefore, careful studies on the mathematical and computational properties of the protocols and algorithms used in this area are necessary to apply or propose new techniques.

2.1. Cryptography Applications

Given its usefulness in ensuring authenticity and secrecy in a communication or data storage, cryptography has applications in several areas, including information security, telecommunications, financial systems, among others. Historically, cryptography has also been of great importance in the military sector due to the intrinsic need for communication security in this area. Therefore, cryptography research is an area in constant evolution.
There are currently several protocols for encrypting and decrypting e-mails, with PGP (Pretty Good Privacy) [4] being a widely used example for the secrecy and privacy requirement. The use of digital signatures to authenticate the sender of the message is also widespread in this area.
In general, protocols in the Internet protocol stack can implement cryptography to increase security. One of the most widely used protocols today that performs this function is TLS (Transport Layer Security) [5]. Encryption is also employed in website certificate verification, where a public key cryptography system is used. Moreover, any website or service that registers its users with login and password usually implements some type of encryption to protect the data against attacks.
Pay TV and similar services also use encryption to control access to the service package [6]. The use of encryption protocols is also widespread on streaming platforms as a way to prevent unauthorized copying and distribution of content.
In mobile telephony, encryption has existed between the mobile phone and the radio base station since the second generation of communication technologies as a way to protect the privacy of communications. Subsequent generations, 3G, 4G, and 5G, have increased the security of communications, even reaching end-to-end encryption solutions [7]. Cryptographic authentication algorithms are also used to authenticate users of the mobile network.
The financial and banking system uses several encryption protocols [8]. Since it is an activity that requires constant authentication and data protection, cryptographic algorithms are used everywhere, from credit cards to bank transfers.

2.2. Security Attacks

The study of attacks is quite complex in itself since they are as numerous and complex as the systems they aim to compromise. Accordingly, we limit our discussion to examples of some attacks to consider when exchanging secret keys [3].
Brute-force attacks consist of going through the entire key space in search of the values that generated what was exchanged. If the secret or key is just a sequence entered by a person, it is possible that the secret is an easy-to-remember word or sequence, which reduces the key space considerably. Brute-force attacks are the simplest and also the easiest to prevent since simply increasing the key space can make this attack unfeasible.
There are also attacks that, through mathematical and computational methods, allow solving the problem whose computational hardness is the basis for the security of the cryptosystem. For example, given that the RSA system is based on factorization of large numbers, if an attacker manages to solve the factorization problem quickly, the entire cryptosystem would be at risk. This type of attack is considered in depth in this paper since we proposed key exchange schemes using mathematical problems as security guarantees.
Another type of attack is the man-in-the-middle (MITM), where an attacker places himself between the two entities that want to communicate and intercepts all messages, exchanging them for their own messages. This type of attack can be solved by implementing an authentication system. The most basic key exchange schemes, such as Diffie–Hellman, are not capable of preventing these attacks. The algorithms proposed in this paper also do not have this goal and should be implemented with the combination of other algorithms to prevent this type of attack.

2.3. Related Work

The integer partition function is a deep mathematical construct from number theory with various applications in cryptography [9]. To enable a modular use of secure protocols in this area, it is generally assumed that both the input and output are secretly shared between two or more parties [10]. For example, Nam et al. [11] explore password-based authenticated key exchange protocols in public network contexts, highlighting the challenges of establishing high-entropy secret keys from low-entropy sources, such as passwords. This complexity resonates with issues identified in the proposed methods as both require a comprehensive understanding of underlying mathematical functions to secure key exchanges effectively.
Another pertinent area of research is addressed by Afzal et al. [12], who assess the cryptographic strength of key schedule algorithms, quantifying their vulnerabilities. They underscore the importance of rigorous evaluation of cryptographic strength in accordance with claims regarding low security in the outlined methods.
In addition, research on password-based three-party authenticated key exchange (3PAKE) protocols presents significant findings. For example, He and Chen [13] critically analyze the vulnerabilities of existing protocols, noting weaknesses that mirror those of the multiple-variable methods proposed in the abstract. Yoon and Yoo [14] also detail vulnerabilities in a password-based three-party authenticated key exchange protocol, emphasizing various attack strategies that could exploit weak key generation processes.
Previous studies have highlighted the implementation of cryptographic protocols based on proven mathematical constructs. Although some of these approaches contain nuances, they do not fundamentally diverge from traditional key exchange methods, which are also vulnerable to contemporary attack vectors [15,16].

3. Proposed Methods

3.1. The Integer Partition Function

Integer partitions consist of the decomposition of natural numbers into a sum of smaller natural numbers [17]. As an example, the number 4 can be represented as 4, 2 + 2 , 3 + 1 , 1 + 1 + 2 , or 1 + 1 + 1 + 1 . These are the integer partitions of 4, of which the summands are said to be a part. For example, 1 is a part of the partition 1 + 3 of the number 4. Thus, the number 4 has four different partitions since changing the order of the parts does not imply a different partition (e.g., 3 + 1 is the same partition as 1 + 3 ).
By associating each integer with the number of possible partitions it has, we obtain the integer partition function P ( n ) . This quantity of possible partitions of a natural number has been the subject of study for many years, which has resulted in several important mathematical discoveries involving number theory throughout history, such as the Rogers–Ramanujan identities [18], and the recent discovery of exact formulas to find the value of these functions [19].
In addition to the function P ( n ) , other functions associated with the integer partition problem are also studied. This is the case of the integer partition functions into k parts, P ( n , k ) . These are the operations on each side of an integer that have exactly k parts. For example, the number 5 has two partitions of three parts: 2 + 2 + 1 and 3 + 1 + 1 , that is, P ( 5 , 3 ) = 2 .
This article focuses on new ways to obtain formulas for P ( n , k ) and the use of these functions in cryptography. A formula for P ( n ) is also presented, resulting from the recurrence relation found for P ( n , k ) .

3.2. Secret Key Exchange: Single-Variable Options

The cryptographic application of the three options presented is the sharing of a secret over an insecure channel between two entities, A and B. The three options are strategies for sharing a secret, each using a different formula involving several P ( n , k ) , but each function calculation p ( n , k ) is the same in each of them.
This secret can then be used, for example, as the key of a symmetric cryptographic system. All options assume that the values n p , n g , k p , and k g are agreed upon between A and B through this insecure channel and are, therefore, public. We also evaluated that the values c A and c B are integers chosen randomly, respectively, by A and B, being taken from the set of keys C = { c N | c m i n c c m a x } , thus being a secret variable for A and another for B. Also, c B is the index up to which B will perform the sum of the list of values A shared.
n p , n g , k p , and k g are variables necessary to establish the secret exchange, assumed to be “public”. In a system that uses this cryptographic scheme, they would compose “public keys”. They are used in the calculation of P ( n , k ) , but they do not compose the “private keys”, which are c A and c B taken from the set C. In analogy with the original Diffie–Hellman, n p , n g , k p , and k g would be like the “g” to which the secret keys a and b ( g a and g b ) must be raised to share and then arrive at g ( a b ) .

3.2.1. Single-Variable Option 1

So, A computes a list L A = l A ( c m i n ) , , l A ( c m a x ) of values, corresponding to the possible values of the term:
l A ( c B ) : = i = 1 c B P ( n g + c A · k g + i · k g 1 , k g 1 )
varying c B in all values of the set of keys C. Since c B is assumed to be smaller than c m a x and larger than c m i n , this list will have c m a x c m i n + 1 values. A sends this list of values to B over the insecure channel ( n p , n g , k p , and k g can be considered constants for each secret key sharing, but they do not have fixed values that are predetermined or that have been analyzed to be the best).
Similarly, B calculates its list of values L B = l B ( c m i n ) , , l B ( c m a x ) based on the possible values of
l B ( c A ) : = i = 1 c A P ( n g + c B · k g + i · k g 1 , k g 1 )
varying c A in all values of the set of keys C. Since c A is also assumed to be smaller than c m a x and larger than a c m i n , this list will have c m a x c m i n + 1 values. B sends this list of values to A over the insecure channel.
A then calculates the values of P ( n g + c A · k g , k g ) and decrements from it the index value c A of the list received from B, i.e., l B ( c A ) . Similarly, B computes the values of P ( n g + c B · k g , k g ) and subtracts from them the index value c B of the list received from A, i.e., l A ( c B ) . Since these are the operations on each side of the equation, the final values computed by A and B are the same and are not directly obtained from the lists shared over the insecure channel. To have access to the data, an attacker would need to know either c A or c B , which are kept secret. These are the secret keys exchanged.

3.2.2. Single-Variable Option 2

Following the same steps as described for option 1, in option 2, A computes the list of values L A that it sends to B using the term:
l A ( c B ) : = i = 1 c B P ( n p k p , k p + c A + i )
and B computes the list of values L B that it sends to A using the term:
l B ( c A ) : = i = 1 c A P ( n p k p , k p + c B + i )
So, A computes the values of P ( n p + c A , k p + c A ) , and B computes the values of P ( n p + c B , k p + c B ) , from which each one removes the index values c A and c B of the list received from the other.

3.2.3. Single-Variable Option 3

In option 3, A computes the list of values L A to send to B using the term:
l A ( c B ) : = i = 1 c B P ( n g + c A · k g + i · k g 1 , k g 1 ) + P ( n p k , k p + c A + i )
and B computes the list of values L B to send to A using the term:
l B ( c A ) : = i = 1 c A P ( n g + c B · k g + i · k g 1 , k g 1 ) + P ( n p k , k p + c B + i )
Then, A computes the values of P ( n g + c A · k g , k g ) + P ( n p + c A , k p + c A ) , and B computes the values of P ( n g + c B · k g , k g ) + P ( n p + c B , k p + c B ) , from which they remove the index value, respectively, c A and c B of the list received from the other.

3.2.4. Limitations and Susceptibility to Attacks

In this section, we analyze each one-variable option and point out its limitations and susceptibility to attacks.
Option 1 uses only two equations for partitioning integers into k parts, one corresponding to k g and one corresponding to k g 1 . Therefore, its implementation is simple, and increasing the number n g does not result in a large increase in computational time since this time continues to be the time required to replace the variable n g in an equation similar to a polynomial.
However, since the equations are known to everyone and the number k g is public, by sharing an element of the list sent by A, it is possible to solve the equation corresponding to this element and reveal c A since this equation has only one variable and it is known that the root sought is an integer. Let us take the following examples.
  • Example 1
Let us take n g = 10 , k g = 4 , c A = 3 , c B = 4 , and c m a x = 8 . A performs the operation: i = 1 c B P ( 10 + 3 · 4 + i · 4 1 , 3 ) , for the eight possible values of c B , and sends this list of values to B.
L A = 52 , 122 , 213 , 327 , 467 , 636 , 836 , 1070
B similarly sends the following list:
L B = 70 , 161 , 275 , 415 , 584 , 784 , 1018 , 1289
A then chooses the third element from the list sent by B and computes the secret with P ( 10 + 3 · 4 , 4 ) i = 1 3 P ( 10 + 4 · 4 + i · 4 1 , 3 ) , finding 191 . B chooses the fourth element from the list sent by A and computes the secret, P ( 10 + 4 · 4 , 4 ) i = 1 4 P ( 10 + 3 · 4 + i · 4 1 , 3 ) = 191 .
However, if an attacker has access to the list that A sends, they can deduce the value of c A by using the equation P ( 10 , 3 ) , equating it to the first value in the list:
P ( 10 + c A · 4 + 4 , 3 ) = P ( 14 + 4 c A , 3 ) = = 1 12 · ( 14 + 4 c A ) 2 + 1 3 · δ 3 ( 14 + 4 c A , 0 ) + 1 4 · δ 2 ( 14 + 4 c A , 1 ) 1 3 = 52 ; c A = 4
We see that by replacing n g or k g with a larger number, or even increasing the value of c m a x , the problem would persist since the equations of P ( n , k ) are similar to polynomials and known by everyone. It is also noted that the number c B would be revealed to an observer of the channel by the same procedure.
Therefore, option 1 is insufficient to perform the secret exchange since by revealing c A and c B , the secret exchanged is revealed to a potential attacker.
Option 2 uses several different “k”. Therefore, its use is conditioned on such equations being known or on there being another algorithm that can obtain P ( n , k ) in a reasonable time since the ideal would be to have a large number of possible values of c A and c B . The recurrence equation could be used to obtain values of P ( n , k ) for small n (< 10 5 ), but these values would not be useful for generating cryptographic keys of considerable size.
However, even if this obstacle is overcome, there is an attack that allows an observer of the channel to know c A and c B . Since we assume that k p and n p are known to everyone, an observer would simply compute a list of values for P ( n p k p , X ) , varying the value X, and compare it with the lists that are exchanged. Let us take the following example.
  • Example 2
Let us take n p = 30 , k p = 4 , c A = 3 , c B = 4 , and c m a x = 8 . A performs the operation: i = 1 c B P ( 30 4 , 4 + 3 + i ) , for the eight possible values of c B , and sends this list of values to B.
L A = 288 , 540 , 752 , 921 , 1054 , 1155 , 1232 , 1288
B similarly sends the following list:
L B = 252 , 464 , 633 , 766 , 867 , 944 , 1000 , 1042
A then chooses the third element of the list sent by B and computes the secret with P ( 30 + 3 , 4 + 3 ) i = 1 3 P ( 30 4 , 4 + 4 + i ) , finding 376. B chooses the fourth element from the list sent by A and computes the secret P ( 30 + 4 , 4 + 4 ) i = 1 4 P ( 30 4 , 4 + 3 + i ) = 376 .
However, the attacker can generate the following list of possible first values:
L a t k = 282 , 300 , 288 , 252 , 212 , 169 , 133 , 101
Thus, by comparing the values, the attacker determines c A = 3 and c B = 4 .
As in the case of option 1, increasing the values of n p and k p will have no effect on the attack. One can increase the value of c m a x , causing an attacker to have to calculate and compare more values for P ( n p k p , X ) , but this would come at an additional computational cost for A and B, proportional to this possible increase in c m a x .
Therefore, option 2 is insufficient to perform the secret exchange.
Option 3 combines the advantages of options 1 and 2. Concerning the part coming from option 1, we can use large numbers n g without greatly increasing the computational time used. By adding the part coming from option 2 in the generation of the exchanged list of values, we also have the change of not using only one equation of P ( n , k ) , but two, and an attacker would not know a priori which equation is in each position of the list since the equation varies with the values of c A (or c B ).
However, the increase in the complexity of the key continues to occur only with the increase in the value of c m a x , which in turn causes an increase in the amount of calculations necessary to generate the lists since the size of the lists is c m a x , a factor that greatly limits our key space. This leads us to explore other possibilities to increase the complexity of the system.

3.3. Secret Key Exchange: Multivariable Options

3.3.1. Multivariable Option 1

Here, we can create a system that uses as key a list of values for each individual A and B instead of just a number. In place of c A and c B , we would have lists of size s, C A = c A ( 1 ) , , c A ( s ) and C B = c B ( 1 ) , , c B ( s ) . Substituting each pair ( c A ( a ) , c B ( b ) ) , 1 a , b s , we have a total of s 2 equations, in the following form:
P ( n p + c A ( a ) , k p + c A ( a ) ) + P ( n g + c A ( a ) · k g , k g ) i = 1 c A ( a ) P ( n p k p , k p + c B ( b ) + i ) + P ( n g + c B ( b ) · k g + i · k g 1 , k g 1 ) = = P ( n p + c B ( b ) , k p + c B ( b ) ) + P ( n g + c B ( b ) · k g , k g ) i = 1 c B ( b ) P ( n p k p , k p + c A ( a ) + i ) + P ( n g + c A ( a ) · k g + i · k g 1 , k g 1 )
If we add all the equations for a and b ranging from 1 to s, we obtain the following:
s · a = 1 s P ( n p + c A ( a ) , k p + c A ( a ) ) + P ( n g + c A ( a ) · k g , k g ) a = 1 s i = 1 c A ( a ) b = 1 s P ( n p k p , k p + c B ( b ) + i ) + P ( n g + c B ( b ) · k g + i · k g 1 , k g 1 ) = = s · b = 1 s P ( n p + c B ( b ) , k p + c B ( b ) ) + P ( n g + c B ( b ) · k g , k g ) b = 1 s i = 1 c B ( b ) a = 1 s P ( n p k p , k p + c A ( a ) + i ) + P ( n g + c A ( a ) · k g + i · k g 1 , k g 1 )
The final secret is also equal to the following:
i = 1 s P ( n p + c A ( i ) + c B ( i ) , k p + c A ( i ) + c B ( i ) ) + P ( n g + c A ( i ) · k g + c B ( i ) · k , k g ) a = 1 s i = 1 c A ( a ) b = 1 s P ( n p k p , k p + c B ( b ) + i ) + P ( n g + c B ( b ) · k g + i · k g 1 , k g 1 ) b = 1 s i = 1 c B ( b ) a = 1 s P ( n p k p , k p + c A ( a ) + i ) + P ( n g + c A ( a ) · k g + i · k g 1 , k g 1 )
However, this last direct formula would require knowledge of both C A and C B and, therefore, cannot be used by any party in the communication.
Equation (14) reveals interesting properties for the exchange of lists. Although a priori s 2 exchanged lists are necessary, one for each equation of the type in option 3, when we add them, we can combine them into a single list, which goes from 1 to c m a x . Each individual A or B can then add the terms of this index list corresponding to the elements of the list C A or C B itself. Consider the following multivariable example:
  • Multivariable Example 1
Let us take n p = n g = 30 , k p = k g = 4 , s = 2 , C A = [ 3 , 5 ] , C B = [ 4 , 6 ] , and c m a x = 8 . A performs the following operation:
i = 1 c B ( b ) a = 1 2 P ( 30 4 , 4 + c A ( a ) + i ) + P ( 30 + c A ( a ) · 4 + i · 4 1 , 4 1 ) = = i = 1 c B ( b ) P ( 26 , 4 + 3 + i ) + P ( 30 + 3 · 4 + i · 4 1 , 3 ) + P ( 26 , 4 + 5 + i ) + + P ( 30 + 5 · 4 + i · 4 1 , 3 )
For the eight possible values of c B ( b ) , it sends that list of values to B.
L A = 903 , 1795 , 2684 , 3577 , 4494 , 5447 , 6457 , 7534
B similarly sends the following list:
L B = 892 , 1781 , 2674 , 3591 , 4544 , 5554 , 6631 , 7791
A then chooses the third and fifth elements from the list sent by B and computes the secret with
2 · a = 1 2 P ( 30 + c A ( a ) , 4 + c A ( a ) ) + P ( 30 + 4 · c A ( a ) , 3 ) a = 1 2 i = 1 c A ( a ) P ( 30 4 , 4 + 4 + i ) = = 2 · P ( 30 + 3 , 4 + 3 ) + P ( 30 + 4 · 3 , 4 ) + P ( 30 + 5 , 4 + 5 ) + P ( 30 + 4 · 5 , 4 ) ( 2674 + 4544 ) = 840
obtaining the number 840. B then chooses the fourth and sixth elements from the list that A sent and does similarly:
2 · b = 1 2 P ( 30 + c B ( b ) , 4 + c B ( b ) ) + P ( 30 + 4 · c B ( b ) , 4 ) b = 1 2 i = 1 c B ( b ) P ( 30 4 , 4 + 4 + i ) = = 2 · P ( 30 + 4 , 4 + 4 ) + P ( 30 + 4 · 4 , 4 ) + P ( 30 + 6 , 4 + 6 ) + P ( 30 + 4 · 6 , 4 ) ( 3577 + 5447 ) = 840
Another advantage of this method is that each element of the exchanged list comes from a partition function equation with degree k g 1 , plus a term of higher degree. In practice, we choose the value of n g large enough so that these values can be considered difficult to reverse in the key space considered, also taking into account the terms that depend on k p and n p .
By increasing s, the number of keys available and possible for use increases, without necessarily increasing the amount of information available to potential observers of the channel. This ensures greater protection against attacks.
One of the attack methods would be to solve, with the c m a x points from the list, a polynomial equation (with the δ -modular functions) with s independent variables, still having as a complicating factor that these points are increased by values that come from an unknown polynomial degree (part added by the term P ( n + c , k + c ) ).
  • Vulnerability to attack by linear system
Despite its advantages, including being robust to brute-force attacks, due to the greater number of keys, a vulnerability was found in the system based on multivariable option 1 to an attack strategy that looks at the problem proposed by the system in a different way, simplifying it. Instead of considering the problem as a system of s independent variables, we can consider it with one of c m a x variables, writing it as follows:
a = 1 c m a x q A ( a ) · P ( n p + a , k p + a ) + P ( n g + a · k g , k g ) a = 1 c m a x q A ( a ) i = 1 a b = 1 c m a x q B ( b ) · P ( n p k p , k p + b + i ) + P ( n g + b · k g + i · k g 1 , k g 1 ) = = b = 1 c m a x q B ( b ) · P ( n p + b , k p + b ) + P ( n g + b · k g , k g ) b = 1 c m a x q B ( b ) i = 1 b a = 1 c m a x q A ( a ) · P ( n p k p , k p + a + i ) + P ( n g + a · k g + i · k g 1 , k g 1 )
In this equation, the lists of numbers Q A = q A ( 1 ) , , q A ( a ) , , q A ( c m a x ) , known to A, and Q B = q B ( 1 ) , , q B ( b ) , , q B ( c m a x ) , known to B, represent, respectively, the number of times that the chosen variable of type c A or c B was equal to a and b, that is, how many of the elements of C A are equal to each a and how many of the elements of C B are equal to each b. The lists Q A and Q B would, therefore, be sufficient to determine the secret exchanged instead of the sets C A and C B . The coefficients coming from the partition functions would be all possible, with the values a and b varying from 1 to c m a x , and these would be known to everyone.
Due to these facts, it is more practical to think of multivariable option 1 as an exchange of lists Q A and Q B . We could then, instead of calculating s variables, just determine the quantities q of each possible value of the variables c, which reduces the calculation time, allowing us to use values of q as large as the value of the calculation space modulo M in which we will be inserted. This allows us to have a greater range of values and prevents brute-force attacks since the key space is assumed to be of considerable size. In this case, we would have s = c m a x variables.
However, the weakness of this option is that it is possible to construct a linear system from the exchanged values of c m a x equations and c m a x variables, and determine whose resolution provides the values of q A ( a ) or q B ( b ) , thus reversing the process of building the exchanged lists and revealing the secret values.The exchanged values sent by A would be
L A = [ i = 1 1 a = 1 c m a x q A ( a ) · P ( n p k p , k p + a + i ) + P ( n g + a · k g + i · k g 1 , k g 1 ) , i = 1 c m a x a = 1 c m a x q A ( a ) · P ( n p k p , k p + a + i ) + P ( n g + a · k g + i · k g 1 , k g 1 ) ]
and similarly sent by B. We would then have a linear system of c m a x equations and c m a x variables (the variables q) for each transmitter, and an attacker would only need to solve one of them to obtain the secret since knowledge of one set Q and the list L of the other is enough to obtain the secret.
Considering that the complexity of solving a linear system is O ( c m a x 2.807 ) (Strassen’s Algorithm, [20]), and the complexity of generating the lists is O ( c m a x 2 ) , there is a difference of order between the cost of exchanging the lists and the cost that an attacker would have to decipher the secret. However, this difference is very small compared to existing cryptographic systems, which leads us to look for other options to perform the secret exchange.

3.3.2. Multivariable Option 2

To generate this option, we sought to generalize the previously shown equations to take advantage of the fact that the variables appear as summation limits. Therefore, we started from a more general equation, considering T as any function of four variables, or a set of random numbers organized in four dimensions.
a = 1 a m a x b = 1 b m a x j = c A , i n f ( a ) c A , s u p ( a ) i = c B , i n f ( b ) c B , s u p ( b ) q A ( a ) · q B ( b ) · T ( i , j , a , b )
Here, we will have three lists of variables for A and for B:
Q A = q A ( 1 ) , , q A ( a ) , , q A ( a m a x ) C A , s u p = c A , s u p ( 1 ) , , c A , s u p ( a ) , , c A , s u p ( a m a x ) C A , i n f = c A , i n f ( 1 ) , , c A , i n f ( a ) , , c A , i n f ( a m a x ) Q B = q B ( 1 ) , , q B ( b ) , , q B ( b m a x ) C B , s u p = c B , s u p ( 1 ) , , c B , s u p ( b ) , , c B , s u p ( b m a x ) C B , i n f = c B , i n f ( 1 ) , , c B , i n f ( b ) , , c B , i n f ( b m a x )
Developing this equation in two different ways, we have
a = 1 a m a x q A ( a ) j = c A , i n f ( a ) c A , s u p ( a ) b = 1 b m a x q B ( b ) i = c B , i n f ( b ) c B , s u p ( b ) T ( i , j , a , b ) = = b = 1 b m a x q B ( b ) i = c B , i n f ( b ) c B , s u p ( b ) a = 1 a m a x q A ( a ) j = c A , i n f ( a ) c A , s u p ( a ) T ( i , j , a , b )
The secret exchange, in this case, would be conducted by exchanging matrices M A and M B . B calculates, varying a from 1 to a m a x and j from 1 to c m a x , to form M B , the possible values of
m B ( a , j ) : = b = 1 b m a x q B ( b ) i = c B , i n f ( b ) c B , s u p ( b ) T ( i , j , a , b )
A does similarly, and, upon receiving the matrix M B , calculates the secret by adding each row from the c A , i n f ( a ) -th term up to the c A , s u p ( a ) -th term and multiplying this sum by q A ( a ) , for each a, and adding everything together. B calculates the secret in the same way.
In the matrix exchange procedure, a total of a m a x · c m a x values (i.e., equation results) are revealed to potential observers of the channel from the matrix generated by B and s B · c m a x values from the matrix generated by A. Assuming a m a x = b m a x = s , we will have 3 s unknowns for A and the same amount for B (s unknowns q and 2 s unknowns c for each) in two systems of s · c m a x equations. Unlike multivariable option 1, this would not be a simple linear system since there are multiplications between the variables and the variables c are at the upper and lower limits of the summations.
The values of the function T ( i , j , a , b ) should, therefore, be chosen in such a way as to make it difficult for an attacker to solve these systems. This work did not extensively evaluate the options for choosing T ( i , j , a , b ) , which could be addressed in future work. It is also important, for practical purposes, to keep in mind the size of the exchanged matrices. In this option, each matrix would have s · c m a x values.
A possible attack strategy against this option would be to assume values for the unknowns c (which range from 1 to c m a x ) and solve the resulting linear systems to obtain possible values for the unknowns q. Once in possession of the values of q, it is possible to check whether the choice made for c’s was the correct one. If so, the attack is successful; if not, it is necessary to assume another set of values for the unknowns c. This attack is subject to having to check all possible values of the set of c’s, which are greater than c m a x s . Thus, the difficulty in carrying it out is exponential with the growth of s, having to solve more than c m a x s linear systems of s variables to check all possible values of the set of c’s.
  • Vulnerability to linear system attack
After a few attempts, it was possible to observe that, like multivariable option 1, this option is also subject to being represented as a linear system and, therefore, also presents this vulnerability. Equation (23) can be further generalized to give rise to
a = 1 a m a x b = 1 b m a x j = c A , i n f ( a ) c A , s u p ( a ) i = c B , i n f ( b ) c B , s u p ( b ) q A ( a , j ) · q B ( b , i ) · T ( i , j , a , b )
Developing the equation in two different ways, we have
a = 1 a m a x j = c A , i n f ( a ) c A , s u p ( a ) q A ( a , j ) b = 1 b m a x i = c B , i n f ( b ) c B , s u p ( b ) q B ( b , i ) T ( i , j , a , b ) = = b = 1 b m a x i = c B , i n f ( b ) c B , s u p ( b ) q B ( b , i ) a = 1 a m a x j = c A , i n f ( a ) c A , s u p ( a ) q A ( a , j ) T ( i , j , a , b )
Although we have apparently increased the number of unknowns, this way of writing the equation allows us to see the lists C as nothing more than zeroing some of the variables q that are not in the intervals added by the auxiliary variables i and j.
a = 1 a m a x j = 1 c m a x q A ( a , j ) b = 1 b m a x i = 1 c m a x q B ( b , i ) T ( i , j , a , b ) = = b = 1 b m a x i = 1 c m a x q B ( b , i ) a = 1 a m a x j = 1 c m a x q A ( a , j ) T ( i , j , a , b )
Thus, solving this more general problem would be equivalent to solving the problem proposed by multivariable option 2. However, this more general problem is simply a linear system but with s · c m a x unknowns. We are again faced with a “breaking” complexity of the secret of the order of O ( ( s · c m a x ) 2.807 ) , against a generation complexity of the secret of the order of O ( ( s · c m a x ) 2 ) , due to the four summations present in the formula.

3.3.3. Multivariable Option 3

Multivariable option 2 does not restrict the choice of the function (or the set of four-dimensional values) T ( i , j , a , b ) ; its construction remains open and can be explored. If we choose fixed values, we impose a necessary amount of memory of A and B to store such values, which would be proportional to c m a x 2 · s 2 . An option to avoid such an imposition is to use a function that benefits from the structure of the Equation (25). For this reason, we chose the integer partition function as follows: first, we added the equations of the recurrence relations.
P ( n g + c · k g , k g ) + P ( n p + c , k p + c ) = P ( n g , k g ) + i = 1 c P ( n g + i · k g 1 , k g 1 ) + + P ( n p , k p ) + i = 1 c P ( n p k p , k p + i )
P ( n g + c · k g , k g ) + P ( n p + c , k p + c ) P ( n g , k g ) P ( n p , k p ) = = i = 1 c P ( n g + i · k g 1 , k g 1 ) + P ( n p k p , k p + i )
This equation is valid for any natural c, including c s u p and ( c i n f 1 ) :
P ( n g + c s u p · k g , k g ) + P ( n p + c s u p , k p + c s u p ) P ( n g , k g ) P ( n p , k p ) = = i = 1 c s u p P ( n g + i · k g 1 , k g 1 ) + P ( n p k p , k p + i )
P ( n g + ( c i n f 1 ) · k g , k g ) + P ( n p + c i n f 1 , k p + c i n f 1 ) P ( n g , k g ) P ( n p , k p ) = = i = 1 c i n f 1 P ( n g + i · k g 1 , k g 1 ) + P ( n p k p , k p + i )
Subtracting the two previous equations, we have
P ( n g + c s u p · k g , k g ) + P ( n p + c s u p , k p + c s u p ) P ( n g + ( c i n f 1 ) · k g , k g ) P ( n p + c i n f 1 , k p + c i n f 1 ) = = i = c i n f c s u p P ( n g + i · k g 1 , k g 1 ) + P ( n p k p , k p + i )
Let then β ( a , b ) be a matrix of different and independent numbers. We then replace n g by β ( a , b ) + j · k g , n p by n p + j , k p by k p + j , c s u p by c B , s u p ( b ) and c i n f by c B , i n f ( b ) . We put the results in such a way as to replace the term T ( i , j , a , b ) on the B side of (25), obtaining
a = 1 a m a x q A ( a ) j = c A , i n f ( a ) c A , s u p ( a ) b = 1 b m a x q B ( b ) i = c B , i n f ( b ) c B , s u p ( b ) P ( β ( a , b ) + j · k g + i · k g 1 , k g 1 ) + + P ( n p k p , k p + j + i )
a = 1 a m a x q A ( a ) j = c A , i n f ( a ) c A , s u p ( a ) b = 1 b m a x q B ( b ) P ( β ( a , b ) + j · k g + c B , s u p ( b ) · k g , k g ) + + P ( n p + j + c B , s u p ( b ) , k p + j + c B , s u p ( b ) ) P ( β ( a , b ) + j · k g + ( c B , i n f ( b ) 1 ) · k g , k g ) P ( n p + j + c B , i n f ( b ) 1 , k p + j + c B , i n f ( b ) 1 )
By performing similarly for side A, we have
a = 1 a m a x q A ( a ) j = c A , i n f ( a ) c A , s u p ( a ) b = 1 b m a x q B ( b ) P ( β ( a , b ) + j · k g + c B , s u p ( b ) · k g , k g ) + + P ( n p + j + c B , s u p ( b ) , k p + j + c B , s u p ( b ) ) P ( β ( a , b ) + j · k g + ( c B , i n f ( b ) 1 ) · k g , k g ) P ( n p + j + c B , i n f ( b ) 1 , k p + j + c B , i n f ( b ) 1 ) = = b = 1 b m a x q B ( b ) i = c B , i n f ( b ) c B , s u p ( b ) a = 1 a m a x q A ( a ) P ( β ( a , b ) + i · k g + c A , s u p ( a ) · k g , k g ) + + P ( n p + i + c A , s u p ( a ) , k p + i + c A , s u p ( a ) ) P ( β ( a , b ) + i · k g + ( c A , i n f ( a ) 1 ) · k g , k g ) P ( n p + i + c A , i n f ( a ) 1 , k p + i + c A , i n f ( a ) 1 )
Although we still need to store the values of β , we have a reduction in the number of dimensions of the data structure required, as well as a reduction in the number of calculations required, due to the reduction in a sum in the general formula. The data structure that would need to be calculated would have a size proportional to s 2 · c m a x , and the complexity of generating the exchanged matrices would be O ( s 2 · c m a x ) . The exchanged matrices, as in the previous option, remain with a number of values s · c m a x .
  • Vulnerability to linear system attack
Since it is a more specific version of multivariable option 2, multivariable option 3 is also subject to the same attack. The possible advantage is in the order of complexity required to solve the linear system compared to the complexity of generating the matrices. The generation of the matrices is conditioned to increase only linearly with the increase in c m a x , while the “breaking” of the option requires a complexity equal to O ( ( s · c m a x ) 2.807 ) . There is then a gain of order 1 in relation to c m a x , when comparing the generation time and breaking time of this option with that of the multivariable option 2.

3.3.4. Multivariable Options Comparison

Multivariable option 1 uses the same equation from single-variable option 3. However, it is expanded to use many values as secret keys, having a list of secret keys for A and B. Multivariable option 2 is a general form of sharing a secret using the summation limits as secret keys. Here, the function T does not necessarily need to be a partition function. Multivariable option 3 uses equations with the partition function to be implemented in the form of multivariable option 2.

4. Results and Discussion

4.1. Simulations

As measures of efficiency and effectiveness of the cryptographic systems presented, we can analyze the time required to exchange secrets and the time an attacker would need to carry out a successful attack. In this sense, simulations were performed to measure the time required to exchange a secret, varying several parameters. Attack scenarios were also simulated.
Whenever applicable, two distinct strategies that could be implemented in real systems were considered. One of them consists of A and B generating new matrices or lists for each new communication, not necessarily by generating new secrets, but possibly also by choosing a random parameter. For example, in multivariable options 1 and 3, a large and random n g could be used for each communication as a way of generating different secrets for each exchange between two devices. Since this strategy implies a significant computational cost added for each exchange, a second strategy was also tested in which A and B have fixed lists or matrices that would be used in every communication, or at least that these lists or matrices change according to a low frequency. One option would be to draw new secret numbers every day or every time the device in question is turned on. In this second strategy, it was also considered that devices A and B would have previously calculated the necessary values, such as integer partition functions, and stored them in memory. Since there is a significant cost to producing the exchanged matrices and lists, the difference between these two strategies is critical to considering real applications.
In order to approximate real situations, a space of size 256 bits, that is, size 2 256 , was chosen as the space to perform the operations. This choice is due to the fact that the secret calculated between A and B can be used later to establish secure symmetric encryption communication, with 256 bits being one of the possible sizes of the AES (Advanced Encryption Standard) protocol.
It is also important to note that, in the case of multivariable option 1, we have s = c m a x , an equality that is not repeated in the other multivariable options.
In all simulations, with the exception of the values that are varied to assess time dependencies in relation to the variables, the values adopted were those in Table 1.
To evaluate the efficiency of the options, two measures of interest were established:
  • t g e r , the time to generate the list or matrix.
  • t c a l c , the time to calculate the secret once the matrices or lists have been exchanged.

4.1.1. Influence of s on t c a l c

As can be seen in Figure 1, the three multivariable options presented the same linear growth behavior in calculation time after the transmission of lists or matrices with the increase in the value of s, with multivariable option 1 being faster because it is a list, not a matrix. This is due to the fact that, in all options, the number of calculations necessary to reach the secret after the exchange of matrices or lists increases linearly with s, this value being the limit of a sum present in the calculation of the secret, as can be seen in the equations of the secrets of each option.

4.1.2. Influence of c m a x on t c a l c

We can see in the graphs in Figure 2 that the growth of t c a l c in relation to an increase in c m a x was linear. Observing the generating formulas of multivariable options 2 and 3, we see that this simulation result was expected. The large variance present in the graph is due to the fact that the choices of variables c, which were randomly chosen in each simulation, impact the number of calculations that must be made to arrive at the exchanged secret. Multivariable option 1 was not analyzed since in this case s = c m a x , and this variation was already discussed previously.

4.1.3. Influence of s on t g e r

Regarding the generation time of lists and matrices, as we can see in Figure 3, the growth was quadratic with the increase in s. In the case of multivariable option 1, we have s = c m a x , with this value as the limit of two consecutive sums. In the case with the possibility of reusing the same list, there is a quadratic increase in total time with increasing s, while in the case of a constant matrix or list, this increase is linear (on each side of Equation (21), both A and B need to perform calculations whose quantities grow with s 2 ). Since, to calculate the values of a new matrix with each exchange, the growth is also quadratic, we have a quadratic result in this case in the same way.
Meanwhile, in multivariable option 2, we have a quadratic dependence on s since we have s as one of the dimensions of the exchanged matrix ( s · c m a x ) and s in the limit of a sum of each member of this matrix, as we see in Equation (25).
In multivariable option 3, in the case of a constant matrix in every exchange, we have s as one of the dimensions of the exchanged matrix and s as the limit of the sum of each member of the matrix. In the case where a matrix is calculated in every exchange, we have a dependence of s 2 on the size of the structure to be calculated, as we see in Equation (37), also resulting in quadratic growth.

4.1.4. Attack Simulations

To test the resistance of the developed options to the attacks evaluated, simulations were also performed. These attacks assume that an attacker would have access to the communication channel used to exchange matrices or lists. Except when variations are shown, the values of the variables required for each option were the same as in the previous simulations.
Due to the large key space in each multivariable option, it is not feasible to perform brute-force attack simulations. It is also important to note that there may be attacks that have not yet been discovered for each option, which were not studied in this work.

4.1.5. Summary of Variable Dependencies

We conclude this chapter with a summary of the impact of each variable considered in relation to the generation times of the matrices and lists and the calculation times of the secret after the exchange.
In Table 2, regarding t g e r , it can be seen that most of the variables did not show a clear correlation since, in these cases, it was considered that the calculation of the partitions would be carried out before the beginning of the exchange process. This table also shows that multivariable option 3 has a linear dependence in relation to c m a x .
In Table 3, we can observe several correlations between the various variables and t g e r , although it was not possible to identify clear correlations with the numbers n g and k p . This table also shows that the linear dependence of multivariable option 3 in relation to c m a x is repeated. This dependence is noteworthy because it represents an advantage of this option in relation to multivariable options 1 and 2.
Regarding t c a l c , all options presented the same behavior, a linear growth of t c a l c both in variations of s and in variations of c m a x (Table 4).

4.2. Application of Integer Partition Function Cryptography

In order to demonstrate the viability of the secret exchanges proposed in Section 3.2, an experiment was developed to simulate a situation in which this exchange is necessary. Using microcontrollers with integrated Bluetooth, a data transmission scenario was implemented between two devices (A and B) through an insecure channel, which was also observed by a third device (E).
In this experiment, the main objective was to verify whether, in an environment with limited resources, it is possible to perform information exchanges in a reasonable amount of time, considering a secure data transmission scenario of, for example, a body sensor or an automotive sensor that uses a wireless channel to communicate with other devices.
To evaluate multivariable options 1, 2, and 3, seen in the previous chapter, several parameters were analyzed. At first, due to the sensitivity of the possible applications to the amount of memory available in each microcontroller, the following parameters were considered:
  • The memory space dedicated to each matrix (or list) to be sent, E M ;
  • The memory space dedicated to storing private values, E P .
The times required to exchange secrets were also analyzed, and the following parameters were specified:
  • The time to generate the matrix (or list), t g e r ;
  • The time to transmit the data, t t r a n s ;
  • The time to calculate the secret, after transmission, t c a l c ;
  • The total time of the exchange, t t o t a l .
Regarding the total exchange time, experiments were conducted with two different approaches: considering that there will be a new calculation of the matrix or list with each new exchange, or considering that there will be only one matrix or list that will be considered as calculated before the exchange begins. In the second case, the matrix or list would function as a public key for communication. However, this prevents the use of a random number in one of the variables (such as n g for example) at the time of generating the matrix or list.
Through these experiments, we sought to determine whether any of the options presented are viable for use in a real situation, where the time and resources available to perform the secret exchange are limited.

4.3. Experiment Specifications

4.3.1. System Architecture

To perform the experiments, three ESP32 boards were programmed: Alice (transmitter A), Bob (receiver B), and Eve (attacker E), assembled as shown in Figure 4. The boards have the technical specifications reported in Table 5. The programming was carried out using the Arduino programming interface [21], compatible with the boards, and C++ was adopted as the programming language. The choice of using a third board equal to the first two as an attacker was made to simulate an attack from a device similar to those involved in the key exchange.
In the situations presented, A initiates communication and establishes a Bluetooth Low-Energy channel with B. The secret exchange is then performed between A and B using one of the multivariable options presented in Section 3.3. Meanwhile, E observes the same channel established by A and B and attempts to perform an attack that reveals the secret.
This communication capability between the three boards was achieved by configuring the boards A and B to automatically connect to any other board that initiated the connection, without requiring any type of authentication from devices that could read the data exchanged between the two. Thus, we would have a situation in which board E could read both the messages that A sends to B and the messages that B sends to A.

4.3.2. Simulation of an Insecure Channel Through Bluetooth

Although version 4.2 of Bluetooth presents means to establish a secure connection through cryptographic techniques, our goal in this experiment was to simulate an insecure channel simulation. Thus, the configuration of the devices was changed to completely open the transmitted data for third parties to observe, not respecting the specifications of the Bluetooth protocol.
This insecure channel works by configuring both devices A and B as server and client of each other. The program starts with both devices announcing their server capabilities. Then, both enable the client capability, which seeks the identification of the each other’s server. After that, the double registration of A as a client of B and B as a client of A occurs. This allowed each device to subscribe to a service (communication channel) and be notified when there was a change in the characteristic, which is the data transmitted in that communication channel. This way, the exchange of messages between A and B was facilitated.
At the same time, the device E searches for the A and B and creates two client entities to connect to each one. Then, E registers to use the same service that B registered on A, and the same that A registered on B, thus having access to all the information exchanged between them.
Although this situation is not comparable to a real situation with the Bluetooth protocol, since it already implements advanced encryption and key exchange solutions that prevent this insecurity, this was a way to simulate a situation in which there is an insecure channel in some other technology with similar capabilities.

4.3.3. Algorithm Specifications

In order to simulate a scenario in which the secret exchanged between A and B would serve as a symmetric key in a subsequent transmission, the secret size was chosen to be 256 bits, which is one of the possible key sizes of the AES standard, only as an example, since the implementation of symmetric key cryptography was not the objective of this work.
The calculations performed by A, B, and E, as well as the values transmitted by them, were all performed using the default size of 256 bits, which means that all operations are performed m o d 2 256 .
Due to the specifications of the chosen devices, considerations regarding memory availability were made so that the values tested for s and c m a x , among others, had to be relatively small, which is in line with our expectation of using this technology in devices with reduced capacity.
In the experiments of multivariable option 2, to simulate a function that was easy to calculate, the following function was chosen:
T * ( i , j , a , b ) = ( a + b ) · ( i + j )
Due to time constraints, it was not possible to analyze whether this chosen function is the most appropriate, and it may have characteristics that facilitate some attack that is currently unknown. In its place, another function that can be calculated quickly may be used in the future.
Similarly, in multivariable option 3, instead of using a matrix of random numbers, β ( a , b ) was replaced by the function:
β * ( a , b ) = a + b

4.3.4. Attacks Evaluated

In none of the options was a brute-force attack considered since the space to which the secret belongs has 2 256 elements, a quantity considered safe for the vast majority of contemporary applications [23]. Thus, to simulate attacks on the secret exchange options presented, focused strategies were chosen according to each option.
For multivariable option 1, as in the simulations presented in chapter Section 3.3, the attack by the linear system was chosen, considering the dimension of the system equal to the size of the exchanged list s = c m a x . Since this is a known vulnerability of this option, it was expected that the board E would be able to carry out successful attacks for the chosen values of s.
For multivariable options 2 and 3, the attack by solving a linear system was chosen, as the case for the simulations in chapter Section 3.3, but with dimensions equal to the size of the exchanged matrices of s · c m a x . Although other attacks not currently known may emerge in the future, the analysis of these other attacks is beyond the scope of this work.

4.4. Experiment Results

Here, we present the results of the experiments performed using plates A, B, and E. Except for the tests in which each variable was analyzed separately, the values of the variables chosen were those reported in Table 6.

Attacks

Secret key exchange attack tests were also performed, using the board E as an observer of the insecure channel constructed by Bluetooth communication, as was previously described. The results of these attacks were consistent with those of the simulations performed in Section 3.3. In both Figure 5 and Figure 6, we see that the growth is polynomial, compatible with the expected growth in complexity when increasing the dimension of a linear system. In particular, it is clear that both the addition of more variables q and c, through the increase in s, and the increase in the possible range of values c generate the same difficulty in breaking.

4.5. Discussion of Results and Alternatives

4.5.1. Comparison Between Options

Table 7 and Table 8 make a comparison between the multivariable options 1, 2, and 3, according to the experimental results, in relation to the growth that each variable presents regarding the increase in s. t t o t a l , 1 and t t o t a l , 2 represent, respectively, the strategies of using a previously determined matrix or list for all communications and calculating a new matrix for each communication.
There is also the variation in computational complexity in relation to the increase in c m a x , which can be observed in Table 8.
In the experimental values obtained, we can see that multivariable option 2 presented the shortest time to generate the value matrix, which occurs because the other two options calculate lists and matrices from integer partition functions, while multivariable option 2 performs simple sums.
It can also be verified, through the graphs of variation of s, that the transmission times of options 2 and 3 were approximately twice that of option 1 because with c m a x = 2 , we have matrices being transferred whose size is twice the list of option 1. If the value of c m a x in options 2 and 3 increased, we would see a linear growth in this transmission time.
The calculation time of option 1 after the exchange of matrices was considerably shorter than the other two options because it presented a sum of only one dimension, while the other options needed to add matrices.
Regarding the total time for secret exchange, all options presented very high times (several seconds) if we consider the efficiency needs of key exchange protocols when we consider the strategy of generating a list or matrix for each new communication. However, if we adopt the strategy of keeping a matrix or list in memory and using it for several communications, the exchange time is restricted to milliseconds, a large part of which is due to the transmission time. More comparative studies are needed to verify the suitability of this key exchange in relation to the options available now.

4.5.2. Results Regarding Attacks

The secret key exchange methods demonstrated in this paper propose mathematical problems as a way to add security to this exchange. This paper explored attacks that focus on extracting the secret values (lists Q and C) from the communication devices through simple mathematical methods. There are other attacks that this work did not analyze, such as man-in-the-middle attacks, which can only be prevented by more complete systems.
It is also possible that there are unknown mathematical methods that make the presented options unsuitable for any type of application. In particular, the vulnerabilities presented by multivariable options 1, 2, and 3, due to being broken through the resolution of linear systems, make them relatively insecure for applications that wish to keep the exchanged messages secret for a long period of time. The security of the options can be increased, mainly in option 3, with little additional computational cost, but the performance is not comparable to existing solutions, which protect the exchanged information for long periods of time.
Although only classical computing algorithms are applied, it is known that due to the existence of the HHL (Harrow, Hassidim, and Lloyd) algorithm, the exchanges presented would be even more vulnerable to attacks using quantum computing [24].

5. Conclusions

In order to present a new method for sharing secret keys in an insecure channel, this paper analyzed several ways of performing this sharing using integer partition functions.
Some examples of insecure communication channels are HTTP (Hypertext Transfer Protocol), FTP (File Transfer Protocol), plain email (SMTP, POP3, and IMAP without TLS/SSL), public Wi-Fi networks, SMS (Short Message Service), Bluetooth (older/weak implementations), and physical media without protection (USB drives/external hard drives).
A proof-of-concept example of some of the key exchange options was shown, using a set of microcontrollers equipped with Bluetooth connection as the application object. Experiments were then carried out to prove the validity of the conclusions drawn through simulations and to explore the challenges of transposing the theoretical solution to a concrete application.
This paper presented a new way to solve the problem of the number of integer partitions that a natural number can have. Therefore, we can conclude that the proposal to approach this topic from a new perspective was successful, which allowed the development of the techniques discussed in the other chapters.
As a result, we obtained a new formula for calculating the function P ( n ) , a function of interest to number theory. This formula comes, in turn, from the development of formulas for calculating the functions P ( n , k ) , related to P ( n ) . During the study of these formulas, ways were sought to make them easier to calculate, which led to the development and study of the δ -modular function, which relates the remainder of the division of two integers by a third integer.
The results obtained regarding the integer partition function may be useful in other areas of mathematics, such as statistics. Furthermore, the use of the δ -modular function to simplify calculations with floor and ceiling functions may be useful for several other related areas.

Author Contributions

Conceptualization, J.P.C.; methodology, D.F.d.N.; software, D.F.d.N.; validation, M.L.M.A.; formal analysis, M.G.; investigation, D.F.d.N. and J.P.C.; writing—original draft preparation, D.F.d.N. and M.G.; writing—review and editing, S.F.L. and J.A.A.; supervision, J.P.C. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

All data are available at https://doi.org/10.5281/zenodo.15532198.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Schneier, B.; Diffie, W. Applied Cryptography: Protocols, Algorithms, and Source Code in C; John Wiley & Sons: Hoboken, NJ, USA, 2015. [Google Scholar]
  2. Shor, P. Algorithms for quantum computation: Discrete logarithms and factoring. In Proceedings of the 35th Annual Symposium on Foundations of Computer Science, Santa Fe, NM, USA, 20–22 November 1994; pp. 124–134. [Google Scholar] [CrossRef]
  3. Boneh, D.; Shoup, V. A Graduate Course in Applied Cryptography. 2020. Available online: https://crypto.stanford.edu/~dabo/cryptobook/BonehShoup_0_4.pdf (accessed on 10 July 2024).
  4. Callas, J.; Donnerhacke, L.; Finney, H.; Shaw, D.; Thayer, R. OpenPGP Message Format. 2007. Available online: https://www.rfc-editor.org/rfc/pdfrfc/rfc4880.txt.pdf (accessed on 10 July 2024).
  5. Rescorla, E. The Transport Layer Security (TLS) Protocol; Version 1.3; Internet Engineering Task Force: Fremont, CA, USA, 2018. [Google Scholar] [CrossRef]
  6. Graf, R.F.; Sheets, W. Video Scrambling & Descrambling: For Satellite & Cable TV; Newnes: Boston, UK, 1998. [Google Scholar]
  7. Njoroge, F.; Kamau, L. A Survey of Cryptographic Methods in Mobile Network Technologies from 1G to 4G. 2018. Available online: https://www.researchgate.net/publication/328902626 (accessed on 10 July 2024).
  8. Grigg, I. Financial Cryptography in 7 Layers; Springer: Berlin/Heidelberg, Germany, 2001; pp. 332–348. [Google Scholar] [CrossRef]
  9. Rajalakshmi, V.; Mala, G.S.A. Integer partitioning based encryption for privacy preservation in data mining. In Proceedings of the First International Conference on Security of Internet of Things (SecurIT ’12), Kollam, India, 17–19 August 2012; pp. 246–251. [Google Scholar] [CrossRef]
  10. Agarwal, A.; Boyle, E.; Chandran, N.; Gilboa, N.; Gupta, D.; Ishai, Y.; Kelkar, M.; Ma, Y. Secure Sorting and Selection via Function Secret Sharing. In Proceedings of the 2024 on ACM SIGSAC Conference on Computer and Communications Security (CCS ’24), Salt Lake City, UT, USA, 14–18 October 2024; pp. 3023–3037. [Google Scholar] [CrossRef]
  11. Nam, J.; Choo, K.K.R.; Park, M.; Paik, J.; Won, D. On the Security of a Simple Three-Party Key Exchange Protocol without Server’s Public Keys. Sci. World J. 2014, 2014, 479534. [Google Scholar] [CrossRef] [PubMed]
  12. Afzal, S.; Yousaf, M.; Afzal, H.; Alharbe, N.; Mufti, M.R. Cryptographic Strength Evaluation of Key Schedule Algorithms. Secur. Commun. Netw. 2020, 2020, 3189601. [Google Scholar] [CrossRef]
  13. He, D.; Chen, J. Cryptanalysis of a three-party password-based authenticated key exchange protocol using Weil pairing. Int. J. Electron. Secur. Digit. Forensics 2012, 4, 244–251. [Google Scholar] [CrossRef] [PubMed]
  14. Yoon, E.J.; Yoo, K.Y. Cryptanalysis of a simple three-party password-based key exchange protocol. Int. J. Commun. Syst. 2011, 24, 532–542. [Google Scholar] [CrossRef]
  15. Pak, K.; Pak, S.; Ho, C.; Pak, M.; Hwang, C. Anonymity preserving and round effective three-party authentication key exchange protocol based on chaotic maps. PLoS ONE 2019, 14, e0213976. [Google Scholar] [CrossRef] [PubMed]
  16. Farash, M.S.; Attari, M.A. An enhanced and secure three-party password-based authenticated key exchange protocol without using server’s public-keys and symmetric cryptosystems. Inf. Technol. Control 2014, 43, 143–150. [Google Scholar] [CrossRef]
  17. Andrews, G.E.; Eriksson, K. Integer Partitions; Cambridge University Press: Cambridge, UK, 2004. [Google Scholar]
  18. Ramanujan, S.; Rogers, L. Proof of certain identities in combinatory analysis. Proc. Camb. Philos. Soc. 1919, 19, 3. [Google Scholar]
  19. Bruinier, J.H.; Ono, K. Algebraic formulas for the coefficients of half-integral weight harmonic weak maass forms. Adv. Math. 2011, 246, 198–219. [Google Scholar] [CrossRef]
  20. Strassen, V. Gaussian elimination is not optimal. Numer. Math. 1969, 13, 354–356. [Google Scholar] [CrossRef]
  21. Arduino. Arduino IDE. 2021. Available online: https://www.arduino.cc/ (accessed on 10 July 2024).
  22. Systems, E. ESP32 Series Datasheet. 2021. Available online: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf (accessed on 10 July 2024).
  23. NIST. Advanced Encryption Standard (AES). 2001. Available online: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197-upd1.pdf (accessed on 10 July 2024). [CrossRef]
  24. Harrow, A.W.; Hassidim, A.; Lloyd, S. Quantum Algorithm for Linear Systems of Equations. Phys. Rev. Lett. 2009, 103, 150502. [Google Scholar] [CrossRef] [PubMed]
Figure 1. t c a l c depending on s shows the computation time of the calculation of a secret key, given multiple values of the s parameter. (a) Multivariable option 1. (b) Multivariable option 2. (c) Multivariable option 3.
Figure 1. t c a l c depending on s shows the computation time of the calculation of a secret key, given multiple values of the s parameter. (a) Multivariable option 1. (b) Multivariable option 2. (c) Multivariable option 3.
Information 16 00637 g001
Figure 2. t c a l c depending on c m a x shows the computation time of the calculation of a secret key, given multiple values of the c m a x parameter. (a) Multivariable option 2. (b) Multivariable option 3.
Figure 2. t c a l c depending on c m a x shows the computation time of the calculation of a secret key, given multiple values of the c m a x parameter. (a) Multivariable option 2. (b) Multivariable option 3.
Information 16 00637 g002
Figure 3. t g e r depending on s shows the computation time of the generation of the exchanged lists/matrices, given multiple values of the s parameter. (a) Multivariable option 1: Same list every time you swap. (b) Multivariable option 1: New list on each exchange. (c) Multivariable option 2. (d) Multivariable option 3: Same matrix every swap. (e) Multivariable option 3: New matrix on each swap.
Figure 3. t g e r depending on s shows the computation time of the generation of the exchanged lists/matrices, given multiple values of the s parameter. (a) Multivariable option 1: Same list every time you swap. (b) Multivariable option 1: New list on each exchange. (c) Multivariable option 2. (d) Multivariable option 3: Same matrix every swap. (e) Multivariable option 3: New matrix on each swap.
Information 16 00637 g003aInformation 16 00637 g003b
Figure 4. Experimental setup.
Figure 4. Experimental setup.
Information 16 00637 g004
Figure 5. t a t k as a function of s. (a) Multivariable option 1. (b) Multivariable option 2. (c) Multivariable option 3.
Figure 5. t a t k as a function of s. (a) Multivariable option 1. (b) Multivariable option 2. (c) Multivariable option 3.
Information 16 00637 g005
Figure 6. t a t k as a function of c m a x . (a) Multivariable option 2. (b) Multivariable option 3.
Figure 6. t a t k as a function of c m a x . (a) Multivariable option 2. (b) Multivariable option 3.
Information 16 00637 g006
Table 1. Values used in simulations.
Table 1. Values used in simulations.
Variable n g n p k g k p c max s
Value 10 100 851110216
Table 2. Dependencies of t g e r , assuming the same array or list every swap.
Table 2. Dependencies of t g e r , assuming the same array or list every swap.
Options c max k g n g k p n p
multivariable 1 O ( s 2 ) -No correl.No correl.No correl.No correl.
multivariable 2 O ( s 2 ) O ( c m a x 2 ) ----
multivariable 3 O ( s 2 ) O ( c m a x ) No correl.No correl.No correl.No correl.
Table 3. Dependencies of t g e r , assuming a new array or list on each swap.
Table 3. Dependencies of t g e r , assuming a new array or list on each swap.
Options c max k g n g k p n p
multivariable 1 O ( s 2 ) - O ( k g 2 ) No correl.No correl. O ( n p )
multivariable 2 O ( s 2 ) O ( c m a x 2 ) ----
multivariable 3 O ( s 2 ) O ( c m a x ) O ( k g 2 ) No correl.No correl. O ( n p )
Table 4. Dependencies of t c a l c .
Table 4. Dependencies of t c a l c .
Options c max
multivariable 1 O ( s ) -
multivariable 2 O ( s ) O ( c m a x )
multivariable 3 O ( s ) O ( c m a x )
Table 5. Microcontroller specifications Espressif Systems ESP32-WROOM-32 [22].
Table 5. Microcontroller specifications Espressif Systems ESP32-WROOM-32 [22].
ProcessorROM MemorySRAM Memory
240 MHz448 KB520 KB
Table 6. Values used in simulations.
Table 6. Values used in simulations.
Variable n g n p k g k p c max s
Value 10 11 511122
Table 7. Computational complexity as a function of s.
Table 7. Computational complexity as a function of s.
Option E M E P t ger t trans t calc t total , 1 t total , 2 t atk
m.var. 1 O ( s ) O ( s ) O ( s 2 ) O ( s ) O ( s ) O ( s ) O ( s 2 ) O ( s 3 )
m.var. 2 O ( s ) O ( s ) O ( s 2 ) O ( s ) O ( s ) O ( s ) O ( s 2 ) O ( s 3 )
m.var. 3 O ( s ) O ( s ) O ( s 2 ) O ( s ) O ( s ) O ( s ) O ( s 2 ) O ( s 3 )
Table 8. Computational complexity as a function of c m a x .
Table 8. Computational complexity as a function of c m a x .
Option E M E P t ger t atk
m.var. 2 O ( c m a x ) O ( c m a x ) O ( c m a x 2 ) O ( c m a x 3 )
m.var. 3 O ( c m a x ) O ( c m a x ) O ( c m a x ) O ( c m a x 3 )
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Nobrega, D.F.d.; Amorim, M.L.M.; Lopes, S.F.; Carmo, J.P.; Afonso, J.A.; Gazziro, M. Secret Cryptographic Key Sharing Through the Integer Partition Function. Information 2025, 16, 637. https://doi.org/10.3390/info16080637

AMA Style

Nobrega DFd, Amorim MLM, Lopes SF, Carmo JP, Afonso JA, Gazziro M. Secret Cryptographic Key Sharing Through the Integer Partition Function. Information. 2025; 16(8):637. https://doi.org/10.3390/info16080637

Chicago/Turabian Style

Nobrega, Daniel Fernandes da, Marcio Luís Munhoz Amorim, Sérgio F. Lopes, João Paulo Carmo, José A. Afonso, and Mario Gazziro. 2025. "Secret Cryptographic Key Sharing Through the Integer Partition Function" Information 16, no. 8: 637. https://doi.org/10.3390/info16080637

APA Style

Nobrega, D. F. d., Amorim, M. L. M., Lopes, S. F., Carmo, J. P., Afonso, J. A., & Gazziro, M. (2025). Secret Cryptographic Key Sharing Through the Integer Partition Function. Information, 16(8), 637. https://doi.org/10.3390/info16080637

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop