Journal of Indian Acad. Math.  
ISSN: 0970-5120  
Vol. 48, No. 1 (2026) pp. 16–22.  
CRYPTOGRAPHIC ALGORITHM BASED ON  
GENERALIZED PELL EQUATION INVOLVING SPHENIC  
NUMBERS  
J. Kannan1, K. Kaleeswari2, and A. Deepshika3  
Abstract. One of the key components for the secure transmission of messages is cryp-  
tography. Strong algorithms are now required in order to convey a message to another  
person. For encryption and decryption, modern academics use several mathematical ideas,  
most notably number theory. In this study, we developed a method that fixes d as a prime  
integer and n as the square of the sphenic numbers, utilizing the well-known generalized  
Pell equation as x2 dy2 = n.  
Keywords: encryption, decryption, the matrix Qp, generalized Pell equation, Sphenic  
numbers.  
2010 AMS Subject Classification: 11A05, 11A07, 11B37, 11D09, 11D99.  
1. Introduction  
Number theory - a basket of properties of numbers, especially integers, is one of the  
most widely used and most attractive theories in Mathematics. It is more advantageous  
subject to master because it encompasses a variety of elements. The creation of Diophan-  
tine equations is one example. These equations are polynomial equations with integer  
coecients and two or more unknowns such that the only solutions of interest are the  
integer ones.  
Diophantine analysis, the mathematical study of Diophantine problems, comprises of  
a special type of equation, commonly known as Pell equation [1]. It is one among the  
various Diophantine equations and it takes the form  
x2 dy2 = 1  
(1)  
where d is a fixed positive integer, not a perfect square. It also has been proved that  
equation (1) has infinitely many solutions in positive integers. This Pell equation is  
generalized as  
x2 dy2 = n  
(2)  
for some integer n.  
Let p be a prime and (xk, yk) be positive integer solutions of the equation x2 py2 = 1.  
x1 py1  
Using these solutions we can define the matrix Qpas Qp=  
[3]. The speciality  
y1 x1  
of this matrix is its kth power can be obtained directly from the kth solution (xk, yk) of  
xk pyk  
equation x2 py2 = 1. That is, (Qp)k =  
.
yk  
xk  
16  
CRYPTOGRAPHIC ALGORITHM  
17  
x1 py1  
y1 x1  
In this paper, we construct a similar matrix Qpa∗  
=
for the equation x21 −  
xr pyr  
yr xr  
py12 = a2, where a Z. The rth power of this matrix is (Qpa)r = ar1  
where  
(xr, yr) is a positive integer solution of x2 py2 = a2.  
In [3], an encryption and decryption algorithms are developed using the Pell equation  
x2 py2 = 1 and its corresponding matrix Qp. Likewise, in this work, we deal with  
the same algorithm with little modifications but we employ the generalized Pell equation  
x2 py2 = a2 and its corresponding matrix Qpa. In particular, here we restrict a as a  
Sphenic number, a number which is a product of three distinct primes. The algorithm is  
made more secure by the sphenic number that is employed here. In this work, we made  
several modifications to the algorithm. The table below shows the dierences between  
the suggested method and the current approach.  
Proposed method  
Existing method  
Cryptographic Algorithm Based on  
Generalized Pell Equation involving  
Sphenic numbers  
Cryptographic algorithm involv-  
ing the matrix Qp[3]  
In this algorithm, we uses the general- Here the authors use the Pell  
ized Pell equation x2 dy2 = a2 where equation x2 dy2 = 1 where x, y  
x, y are integers, d as non square posi- are integers , d as a non square  
tive integer and a is the sphenic number positive integer  
xr pr  
yr xr  
xr pr  
yr xr  
We use the (Qpq)r = ar1  
We use the (Qpq)r =  
for decryption  
for decryption  
2. Notations  
In this section, we display the notations and position of characters needed for the  
encryption and decryption.  
B - 2n × 2n matrix which is constructed using the given message.  
Bk - kth block of B with the size 2 (ie, 2 × 2 matrix).  
b - number of blocks of the matrix B.  
2
if b is 1 or 2n (n N)  
p =  
smallest prime divides b if b is 2n + 1(n N)  
b
if b p  
r =  
p if b > p  
dk - determinant of the matrix Bk.  
bk1 bk2  
bk3 bk4  
- elements of Bk  
E=[dk, bki]i=1,2,4 - encrypted matrix.  
18  
J. Kannan, K. Kaleeswari, and A. Deepshika  
q1 q2  
q3 q4  
- elements of (Qpa )r  
δ -notation for space.  
(x, y) - Positive integer solutions of x2 py2 = a2  
a - Sphenic number  
2.1. Character’s Position.  
A
B
C
D
E
F
G
apr2  
apr2 + 1 apr2 + 2 apr2 + 3 apr2 + 4 apr2 + 5 apr2 + 6  
H
I
J
K
L
M
N
apr2 + 7 apr2 + 8 apr2 + 9 apr2+10 apr2+11 apr2+12 apr2+13  
O
P
Q
R
S
T
U
apr2+14 apr2+15 apr2+16 apr2+17 apr2+18 apr2+19 apr2+20  
V
W
X
Y
Z
δ
apr2+21 apr2+22 apr2+23 apr2+24 apr2+25 apr2 1  
3. Algorithm  
In this section, we present the encryption and decryption algorithms.  
3.1. Encryption.  
(1) Using the given text we have to construct the matrix B of order 2n × 2n.  
(2) Convert the matrix B into the block matrix Bk of the order 2 × 2.  
(3) Finding the number of blocks b and select r using p and b.  
(4) p can be choosen in two ways as given above.  
(5) Choose any Sphenic number a.  
(6) Instead of using the characters in Bk we apply their positions using the above table  
to find the elements of Bk.  
(7) Find the determinant dk of the matrix Bk.  
(8) Using the elements of Bk and their determinant we construct E.  
3.2. Decryption. Using the encrypted matrix E we have to decrypt.  
(1) Construct the (Qpa )r .  
(2) We have the elements of (Qpa )r as qs.  
k
(3) Find ωk1 and ωk2, where ωk1 = q1bk1 + q3bk2 ,ωk2 = q2bk2 + q4bk2.  
(4) Solve for tk using a2rdk = ωk1(q2tk + q4bk4) ωk2(q1tk + q3bk4).  
(5) Now substitute bk3 instead of tk.  
(6) At last we construct Bk and B.  
4. Examples  
Let us see some examples for two dierent values of a.  
CRYPTOGRAPHIC ALGORITHM  
19  
4.1. Encryption and Decryption of BETA. . Encryption:  
B E  
T A  
(1) B =  
(2) There is only one block and so b = 1.  
(3) By definition of p and r, we have p = 2 and r = 1. Choose a = 105.  
211 214  
229 210  
(4) Thus B1 =  
and so bs are given by b11 = 211, b12 = 214, b13  
=
1k  
229, b14 = 210.  
211 214  
229 210  
(5) d =  
= -4696  
1
(6) E =  
4696 211 214 210  
Decryption  
315 420  
210 315  
2∗  
105  
(1) Q  
=
.
(2) Here q1 = 315, q2 = 420, q3 = 210, q4 = 315  
(3) ω11 = q1b11 + q3b12 = 111405 and ω12 = q2b12 + q4b12 = 156030.  
(4) a1d1 = ω11(q2t1 + q4b14) ω12(q1t1 + q3b14) t1 = 229  
(5) b13 = t1 = 229  
211 214  
229 210  
(6) Hence we get B1 =  
from E.  
B E  
T A  
(7) B =  
4.2. Encryption and Decryption of My favourite subject is mathematics. En-  
cryption:  
M Y  
δ
F
A V  
O U R I  
T
E
E
δ
δ
S U B J  
(1) Now B =  
C
T
δ
I
S
M A T H E M  
A T C S  
I
δ
M Y  
O U  
δ F  
A V  
T E  
(2) Here b = 9. We get B1 =  
, B2 =  
, B3 =  
, B4 =  
R I  
δ
S
,
C T  
U B  
J E  
M A  
A T  
T H  
E M  
B5 =  
, B6 =  
, B7 =  
, B8 =  
, B9 =  
δ
I
S
δ
I
C
S
δ
20  
J. Kannan, K. Kaleeswari, and A. Deepshika  
(3) We have p = 3 < b and r = 3. Choose a = 30.  
822 834  
824 830  
809 815  
827 818  
810 831  
829 814  
809 828  
812 829  
(4) Hence B1 =  
, B2 =  
, B3 =  
, B4 =  
,
822 810  
810 829  
830 811  
809 818  
819 814  
828 809  
B5 =  
, B6 =  
, B7 =  
,
829 817  
818 812  
814 822  
828 809  
B8 =  
, B9 =  
(5) The determinants dk are given by  
k
1
2
3
4
5
6
7
8
9
dk  
-4956 -12243 -29559 -1675 22841 -11421 25338 4842 -22090  
4956  
822 834 830  
12243 809 815 818  
29559 810 831 814ꢊ  
1675  
809 828 829  
830 811 818  
(6) The Encrypted matrix, E =  
22841  
11421 819 814 809  
25338  
4842  
822 810 829  
829 817 812  
22090 814 822 809  
Decryption  
702000 1215000  
3∗  
30  
(1) (Q )3 =  
405000  
702000  
k
1
2
3
4
(2) The qks are  
qk 702(10)3 1215(10)3 405(10)3 702(10)3  
ω11  
ω12  
ω21  
ω22  
ω31  
103(914814) 103(1584198) 103(897993) 103(1555065) 103(905175)  
ω32  
ω41  
ω42  
ω51  
ω52  
103(1567512) 103(903258) 103(1564191) 103(911115) 103(1577772)  
(3)  
ω61  
ω62  
ω71  
ω72  
ω81  
103(904608) 103(1566513) 103(905094) 103(1567350) 103(912843)  
ω82  
ω91  
ω92  
103(914814) 103(1584198) 103(897993)  
CRYPTOGRAPHIC ALGORITHM  
21  
(4) Solving this equation a2rdk = ωk1(q2tk + q4bk4) ωk2(q1tk + q3bk4), we get  
k
1
2
3
4
5
6
7
8
9
tk 824 827 829 812 809 828 810 818 828  
822 834  
824 830  
809 815  
827 818  
810 831  
829 814  
(5) Thus we get B1 =  
, B2 =  
, B3 =  
, B4 =  
809 828  
812 829  
,
830 811  
809 818  
819 814  
828 809  
822 810  
810 829  
829 817  
818 812  
B5 =  
, B6 =  
, B7 =  
, B8 =  
,
814 822  
828 809  
B9 =  
from the encrypted matrix E.  
M Y  
δ
F
A V  
O U R I  
T
E
E
δ
δ
S U B J  
(6) Hence B =  
C
T
δ
I
S
M A T H E M  
A T C S  
I
δ
Note 1. The R program was also used to validate these examples.  
5. Conclusion  
In this paper, (Qpa )r constructed using the solutions of x2 py2 = a2 using the choices  
of a and p. By using very high prime numbers can further secure the process. We encrypt  
and decrypt the message using the generalized Pell Equation of the form x2 dy2 = n  
where d and n are prime (p) and square of a sphenic number (a2) respectively. This  
content is the generalization of [3]. We may also extend this with any other Diophantine  
Equation or we may use any other choices of a.  
REFERENCES  
[1] Dickson, L. E.,History of the Theory of Numbers, Volume- II Diophantine Analysis, Dover Publications, New  
York (2015).  
[2] Gould, H. M., A history of the Fibonacci Q-matrix and a higher-dimensional problem, Fibonnaci Quart,  
19(3), 250-257, (1981).  
[3] Kannan, J., Mahalakshmi, M., & Deepshika, A., Cryptographic algorithm involving the matrix Qp, Korean  
J. Math, 30(3), 533-538, (2022).  
22  
J. Kannan, K. Kaleeswari, and A. Deepshika  
[4] Kannan, J., & Manju Somanath, Fundamental Perceptions in Contemporary Number Theory Nova Science  
Publisher, New York, (2023).  
[5] Kannan, J., Manju Somanath., Mahalakshmi, M., & Raja, K., Encryption decryption algorithm using so-  
lutions of pell equation. International Journal for Research in Applied Science and Engineering Technology,  
10(1), 1-8, (2022).  
[6] Sumeryra, U. C. A. R., Nihal, T.A.S., & Ozgur, N.Y., A new application to coding theory via Fibonacci and  
Lucas numbers, Mathematical Sciences and Applications E-Notes, 7(1), 62-70, (2019).  
[7] Titu Andreescu., Dorin Andrica., & Ion Cucurezeanu, An introduction to Diophantine equations: a problem  
- based approach. Birkhauser Boston, (2010).  
(Received, July 21, 2025)  
(Revised, August 02, 2025)  
1Department of Mathematics,  
Ayya Nadar Janaki Ammal College,  
(Autonomous, aliated to Madurai  
Kamaraj University), Sivakasi.  
Email1: jayram.kannan@gmail.com  
2,3Ayya Nadar Janaki Ammal College,  
(Autonomous, aliated to Madurai  
Kamaraj University), Sivakasi.