Linear Algebra and Computer Application (Math149) Project On Cryptography (Hill Cipher Method)
Linear Algebra and Computer Application (Math149) Project On Cryptography (Hill Cipher Method)
Submitted by:
RANDY E. MOLEJONA
DIEGO T. RAMOS
Submitted to:
(PIN), bank account numbers and passwords are classified information that people use
in order to enable daily transactions and satisfy their financial needs (Worthington,
2010). However, some individuals may find it difficult to remember such details, and
may find it necessary to physically take notes of these data down such as on a piece of
paper kept in their wallets, or typed down in their cellphones, and other places that can
According to Thiruchelvi (2014), while writing these down may be the easiest way
of remembering information, this also makes it easily accessible for other people, more
so when kept in predictable places. This makes these information vulnerable as they
can be easily exposed to people who may misuse such sensitive data. On the other
hand, one might forget these data, and taking only mental notes may increase the
likelihood of losing access to one’s accounts and properties being unable to recall their
In the financial system and the economy, commercial banks play an important
role as key components in the financial system whereas banks allocate funds from
which reduce the cost of obtaining information about both savings and borrowing
opportunities. These financial services help to make the overall economy more efficient
In order to optimize the security on bank information, this paper aims to provide a
method in encoding personal information such as bank accounts, pins, and passwords
without exposing the actual data through the computer application of linear algebra.
Specific Objectives
1. To utilize the Hill Cypher Method with substitution ciphers and linear algebraic
METHODOLOGY
The Hill Cipher Method was invented by Lester C. Hill in 1929. It uses
based on linear algebra. it was the first polygraphic cipher in which it was practical
In the following example, the Hill Cipher Method will be used in order to secure a
Take for example a bank account number 5470 8845 7860 8218. This can be placed
Encoding in MATLAB:
5 4 7 0
8 8 4 5
𝑀=[ ]
7 8 6 0
8 2 1 8
Now, a cipher matrix C that is the same size as your M matrix is needed. One can
come up with the cipher matrix by using random integers. It is necessary to take note of
this matrix as this will be a personal cipher for decrypting one’s own encryptions.
After this, the resulting matrix must be encoded in the MATLAB where operations
will be used in order to create the Cipher Matrix, which is also needed for the encryption
later on.
Encoding in MATLAB:
2 −9 −9 8
1 3 4 −1
𝐶=[ ]
7 6 8 1
−3 5 2 4
To create a ciphertext matrix T, which is what one should note down as their “keycode”
for their actual bank account number, multiply the cipher matrix C with the message
matrix M.
Encoding in MATLAB:
Step by Step Process:
𝐶𝑀 = 𝑇
This will be the encrypted message one will want to keep around as their note. To
decode this back to the message matrix M, simply multiply the inverse of the cipher
Encoding in MATLAB:
Step by Step Process:
𝐶 −1 𝑇 = 𝑀
5 4 7 0
8 8 4 5
𝑀=[ ], with bank account number 5470 8845 7860 8218.
7 8 6 0
8 2 1 8
So next time, instead of writing down one’s actual bank account number or any
other piece of sensitive information, it is suggested that they create a ciphertext for it
account number with corresponding numbers of the number of the first letter when
the number is spelled (e.g. 5 is Five, and F is the sixth letter of the alphabet, hence
5 = 6). This process creates substitution ciphers, which are ciphers created by
substituting a non-numerical character into an integer. And so, the original matrix:
5 4 7 0 6 6 19 26
8 8 4 5 5 5 6 6
𝑀=[ ] can be encrypted into 𝑀 = [ ].
7 8 6 0 19 5 19 26
8 2 1 8 5 20 15 5
Encoding in MATLAB:
Repeating the same steps of multiplying the message matrix M with the same
Encoding in MATLAB:
𝐶𝑀 = 𝑇
Encoding in MATLAB:
𝐶 −1 𝑇 = 𝑀
6 6 19 26
5 5 6 6
=[ ]=𝑀
19 5 19 26
5 20 15 5
Remember to decrypt the message matrix M back since this is the substitution
cipher for the original bank account number. Recall that corresponding numbers of
the number of the first letter when the number is spelled was used. So reversing this
process, 6 on matrix M would mean the sixth letter of the alphabet, which is F.
There are only two single-digit numbers that are spelled with the first letter as F,
namely Four and Five. It can be deduced from both options if which would be the
correct input. Eventually, one will be able to decrypt and recall back the original bank
6 6 19 26 5 4 7 0
5 5 6 6 8 8 4 5
𝑀=[ ] will be decrypted back to 𝑀 = [ ].
19 5 19 26 7 8 6 0
5 20 15 5 8 2 1 8
So now, the original bank account number 5470 8845 7860 8218 is back.
CONCLUSION
consider using the Hill Cipher Methods to secure these data when noting down them
down, and make sure that personal information will remain confidential and more
an occurrence of an effective filter of the information so that while the code may be
seen in plain sight, it would not be easily understood since there is a layer of
protection.
The issue regarding privacy of information will remain controversial the moment
people will not consider securing the information. They must be able to foresee the
potential threats to their information to avoid the consequences that they may face
Basel Committee on Banking Supervision (30 November 1999). "Principles for the
Retrieved 28 January 2016. Credit risk is most simply defined as the potential that a
bank borrower or counterparty will fail to meet its obligations in accordance with
agreed terms.
Bolt, Wilko; Haan, Leo de; Hoeberichts, Marco; Oordt, Maarten van; Swank, Job
https://applicationanthologys16.wordpress.com/2016/02/12/cryptography-
from http://conference.bonfring.org/papers/sankara_iciip2014/iciip88.pdf on
u/~tushar/S10Linear2700%20%20Project_files/Worthington%20Paper.pdf on