AES PAPER For Submition 02-03-24
AES PAPER For Submition 02-03-24
JS PLATFORMS
Abstract
A pressing need has arisen because to the quick development of communication technologies, including
as satellite networks, mobile, internet, and terrestrial communications, to prevent copying and tracking as
well as to secure essential individual, general, and universal devices and their little data from attackers.
Photos are transmitted through an unreliable channel from a variety of sources; some of the photos
include sensitive information, while others are very secretive, making their protection from assault
absolutely vital. In this study, the effectiveness of the Advanced Encryption Standard (AES) algorithm
implementation in Java and Node.js is adopted. The study focuses on the utilization of widely used AES
implementations on our primary scripting and web programming languages, such Java and Node.js. The
study's goal is to calculate the price of data encryption and decryption on these platforms, expressed in
terms of data type per byte/payload. This experiment uses the AES algorithm in Cipher Block Chaining
(CBC) mode with 128-bit for Java platform and 256-bit for Node.js platform to encrypt and decode data.
We offer the findings in this post, along with the benefits and drawbacks of utilizing the AES algorithm
on these significant web sites. The Java Cryptography Architecture (JCA) and Java Cryptography
Extension (JCE), together with two components of the performance and efficiency-oriented Java
programming language, provide a mature runtime environment with optimized cryptographic libraries
and APIs. It supports several operating modes and offers a broad variety of AES implementations.
'crypto', a constrained built-in cryptography module in Node.js, offers fundamental cryptographic
operations. This paper describes an experimental investigation that uses the computer languages Java and
Node.js to estimate and evaluate the average encryption and decryption times on the selected algorithm.
Keywords: Encryption, Decryption, Advanced Encryption standard (AES), Cryptography.
1
INTRODUCTION
Because of the internet's and communication technology's rapid development, people now share
information through digital photographs. A digital image is made up of a group of pixels
arranged into a matrix. This growing use of technologies for information storage and sharing,
such as personal computers, mobile phones, and many other means of alternative
communication, has increased the number of users [1]. Due to this rapid advancement of
communication technologies, such as satellite networks, mobile, internet, and terrestrial
communications, there is an urgent need to thwart copying and tracking as well as to protect vital
individual, general, and universal devices and their small data from intruders [2]. In addition,
more unauthorized users are making an effort to collect unauthorized information. Unfortunately,
by its nature, the Internet cannot guarantee the safety of the information it transmits [3].
Information security is the root of this. Knowledge is communicated or kept in an encrypted
fashion to address this flaw. An unauthorized user cannot decipher this encrypted information.
Information is protected both during storage and transmission. Thanks to cryptography, a branch
of knowledge security science. Each secret writing algorithm and secret writing technique
includes two components: an algorithm and a secret writing key usage. In order to stop the
leakage of sensitive data, data encryption has become crucial for enterprises. This means that no
personal employee information, including usernames, passwords, and contacts, can be
transferred. Because of this, encryption is crucial to every information system. Use of a variety
of coding techniques has become necessary to safeguard sensitive information from unauthorized
users [4]. It is crucial to encrypt any multimedia content that needs to be transferred. Therefore,
image encryption, a branch of the science of cryptography, is essential for protecting the images
sent and received over mobile communications, pay-TV, e-commerce, personal emails, the
transmission of financial information, the security of ATM cards, laptop passwords, and other
aspects of daily life. Algorithms are used in ciphering the process of cryptography.
[5] pointed out that one of the well-known methods for protecting image secrecy over a
trustworthy, unconstrained public medium is image encryption. Since the medium of
communication is attackable, effective encryption algorithms are a requirement for secure data
transit.
According to its creators, the concurrent, class-based, object-oriented Java programming
language is so basic that any developer can pick it up quickly. It is intended for widespread use.
Although the Java programming language is comparable to C and C++ in function, it is
structured differently, incorporating ideas from other languages while excluding some C and C+
+ features. Many times, Java programs are converted into bytecode that may be run on any Java
Virtual Machine (JVM), regardless of the underlying computer architecture. Java contains fewer
low-level objects than C and C++, but its syntax is identical to both. Dynamic functionality (such
thinking and changing code while it is running) that is not often available in conventionally
translated languages is provided by the Java runtime environment.
2
In this work, a Java cryptographic library from [6] was used. Free, cross-platform, and capable of
running on a V8 system, Node.js is a back-end JavaScript runtime engine. Outside of a web
browser, JavaScript code is executed by it. Node.js thus represents the "everywhere" paradigm,
which unifies the development of web applications around a single programming language as
opposed to numerous server-side and client-side scripting languages. Despite the fact that the
default file extension for JavaScript code is ‘.js’, the name "Node.js" is only used to indicate a
product in this context and does not associate with a specific file. These design strategies aim to
improve the bandwidth and scalability of real-time web applications as well as web applications
with various I/O activities [7].
This study made use of the crypto library in [8]. This study encrypted data that mimics the most
typical file types. The Advanced Encryption Standard, or AES, is the appropriate algorithm. Java
and node.js are two computer languages that are used to encrypt and decode data. In order to
compare performance, the average encryption and decryption times for Java and Node.js are
calculated individually. Three alternative key sizes—128, 196, and 256 bits—are used by the
symmetric cryptographic method known as the Advanced Encryption Standard (AES). All initial
data, including the encryption key, is calculated in bytes since the AES algorithm processes all
data and encryption in bytes. 128 bits are used for the initial block size, and everything is
mathematical. The length of the key determines how many times the AES algorithm will be
executed. The strength of the encryption is influenced by the length of the key, the length of the
key's code, and the difficulty of obtaining the key.
REVIEW OF RELATED WORKS
An incredibly contemporary Hill (AdvHill) cipher algorithm that codes using an unconscious key
matrix is projected in [9]. They mishandled both the original Hill cipher algorithm and their
proposed AdvHill cipher formula to encrypt entirely distinct photos. Additionally, it is obvious
that the original Hill Cipher cannot correctly decrypt images that contain a lot of identically
colored or grayscale space. They are generating a self invertible matrix for the Hill Cipher
algorithm. Using this key matrix, they encrypted grayscale as well as colour images. Their
algorithm works well for all types of gray scale as well as colour images except for the images
with background of same gray level or same colour.
[10] does research on algorithmic methods for image secret writing and DES confidential/secret
writing as well as disorderly confidential/secret writing. The new secret writing theme's first
strategy involves creating a pseudo-random sequence using a logistic chaos sequencer, carrying
on the RGB with this order to the image carelessly, and then creating double time encryptions
with advanced DES. Their findings demonstrate strong initial sensitivity, high security, and rapid
secret writing.
[11] investigated a novel algorithm for image coding supported SHA-512 hash performance. The
algorithmic rule consists of 2 main sections: the primary will pre the operation to shuffle one half
image. The second uses a hash function to come up with a random variety mask. The mask is
then XORed with the opposite part of the image that is going to be encrypted.
3
A new image encryption technique based on random pixel permutation is also proposed by [12]
with the goal of preserving image quality. The method divides the encryption procedure into
three steps. The picture encryption stage is the first. The crucial generation phase is the second
stage. The procedure of identification is the third stage. With fewer computations, this offers
anonymity to colored images. The permutation procedure is much more efficient and rapid.
[13] analyzed the Advanced Encrypting Standard (AES), and in their image encryption
techniques they build on a key stream generator (A5/1, W7) to AES to confirm rising the
encoding performance. A new permutation approach called RijnDael is introduced by [14]
Mohammad and (2008). It combines image permutation and acknowledgment coding scheme.
The original image was divided into blocks of four pixels by four pixels, which were then
rearranged using a permutation method to create a permuted image. The resultant image was
then encrypted using the RijnDael formula. Their findings demonstrated that using the mix
technique significantly reduced the connection between image components and increased
entropy.
[15] outlines a two-section encoding and decryption process that works by randomly rearranging
the pixels in the image using an affine redesign, then encrypting the resulting image using an
XOR operation. They use affine remodel techniques with four 8-bit keys to redistribute the
element values to completely other locations. The original image is then split into blocks of two
by two pixels, with each block being encrypted using an improper XOR operation with four 8-bit
keys. The method uses a sixty-four bit full key size. Their findings showed that the correlation
between element values was significantly reduced following the affine redesign.
3.0 Materials and Methods
For the purpose of gathering data for this study, we use an experimental approach. To automate
and generate research data, a simple program for encryption and decryption has been developed.
The obtained data was investigated utilizing quantitative analytical methods, and the results are
presented in the study's results section. This study's experiment aims to help measure how web
programming languages are used to encrypt and decrypt digital images (pictures) that are sent
from one end to another, as well as the most widely adopted implementation, methods, and
libraries, as well as the use of the AES algorithm or data encryption. AES keys of 128 bits, and
256 bits were used in the experiment respectively for Java and Node.js platforms. An encryption
key known as a symmetric key is used to encrypt and decode digital images, reading each bit of
the image as it is encrypted. The sidebar or an alphanumeric character (+,*), for example, can be
used to generate this key. The key, known as a Non-byte encrypt, will be generated using Java
and Node.js crypto tools. The symmetric key must first be generated in order to create the image
before encrypting the file with it. Each bit from the image is sent to the system, which then
encrypts each bit before adding it to the main file. After encryption, the file will be sent to the
recipient. The main goal of encryption is to prevent unauthorized access to the material. The
recipient receives the file once it has been encrypted by giving them the symmetric key. The
same procedure is used for decryption: the encrypted file is passed to the system, which then
4
decrypts every bit surrounding it to create a new file with the same extension and finally outputs
the results. The majority of platforms provide microsecond accuracy, but Java supports
nanosecond accuracy, such that the results have the same resolution, microseconds, and precision
for all systems. A total of 30 files, with 145 bytes and 32 MB apiece, were created. To ensure
exceptional accuracy, the process of encrypting and decrypting this data was repeated 100 times
for each combination of data size and AES key size. The experiment utilized the same hardware
and software.
3.1. Algorithm
Making a symmetric key, which will be used to encrypt the image of the numbers. This is the
sole key that will be understood by both the sender and the recipient, and it is used to create files
containing encrypted data by changing the data or bit in those files to a new bit that no one else
can access or understand.
_________________________________________________________________________
Algorithm: Pseudocode for AES encryption algorithm
_______________________________________________________________
STEP 1: Function AES (byte in[16]), byte out [16], key_array round key (Nr +1)
STEP 2: byte state [16]
STEP 3: state = in
STEP 4: AddRoundKey(state,round_key[0])
STEP 5: for i =1to Nr-1 do
STEP 6: SubBytes(state)
STEP 7: ShiftRows(state)
STEP 8: Mixcolum(state)
STEP 9: AddRoundKey(state,round_key[i])
STEP10: SubBytes(state)
STEP11: ShiftRows(state)
STEP12: AddRoundKey(state,round_key[Nr])
STEP 13: out = state
STEP 14: return out
4.0. Implementation
We used Java and Node.js as the Runtime Environment, JavaScript (node.js) as the primary
programming language, and the AES method to encrypt and decrypt the digital image. The
encryption and decryption operations will be carried out using Java and the node.js library
because of their effectiveness and speed, as well as their ability to swiftly scale up to meet bigger
loads. Since it can handle more demanding tasks like handling enormous amounts of data
encryption and sending responses over the internet, it is the programming language of choice for
creating this system. The framework of nod.js is based on Angular, while the frontend language
is composed of Typescript and Javascript. Javascript serves as the backend language, while
Node.JS serves as the backend framework for NodeJS. JavaScript code can be run outside of a
web browser using Node.js, an open source, cross-platform runtime engine that runs on a V8
5
computer. Figures 1A through Figure 7G illustrate the process for encrypting and decrypting the
data picture used in this research.
(B)
(A)
Fig 2 Upload original image
Fig 1 First interface
(C) (D)
Fig 3 Encryption process Fig 4 Encryption Done
(E) (F)
Fig 5 Upload encrypted image to decrypt
Fig 6 Decryption process
(G)
Fig 7 Decryption Done
6
4.1. RESULT AND DISCUSSION
Once the Java and Node.js programs that generate the study data depicted in table 1 and the
included information therein have been executed, it generates the dataset arising from this
analysis as shown in tables 2 and 3. We compute the typical encryption time and decryption time
per iteration in fig. 11 because the time required to complete data encryption and decryption
depends on the sum of 100 repetitions. By raising the number of retries, you gain weight by
lowering the noise that may be caused by unplanned operating system events. By dividing these
figures by the overall size of the encrypted data, the total time per Byte for each combination of
key size, programming language, and platform is computed. According to the platform,
operation, and key size, based on the normal time required to fully decrypt the data, the mean
time (in ns) for full encryption and decryption demonstrates that Java AES implementations are
now the most efficient and quick in terms of performance using the AES128 algorithm,
exceeding node.js with AES256 algorithm. Fig. 9 and 12 display the typical times, in
milliseconds, required to carry out encryption and decryption operations on each content
platform in the zone of 145 bytes at 32M. Based on the normal time required to fully decrypt the
data, Fig. 11 provides a visual conclusion that, in terms of performance, Java has generally
demonstrated to be the best option for data encryption in the algorithm tested even at 128-bits
AES computation. The mean time (in ns) for full encryption and decryption demonstrates that
Java AES implementations are now the most efficient and quick in terms of performance,
exceeding node.js. According to the amount of the encrypted data, the key size, which is
determined by the key length, in bytes, and the overall encryption and decryption time, a group
of raw data records can be formed for further analysis. Fig. 13 displays data on the typical
encryption and decryption times in nanoseconds for a byte of data. Analysis of the information
gathered was also used to obtain the data.
7
Key Size Payload Size Duration (ns) Operation Platform
128 145 172091 ENCRYPTION Java
128 145 293555 DECRYPTION Java
128 145 193368 ENCRYPTION Java
128 145 142647 DECRYPTION Java
128 145 136840 ENCRYPTION Java
128 145 3269115 DECRYPTION Java
128 145 175830 ENCRYPTION Java
128 145 135301 DECRYPTION Java
128 145 139426 ENCRYPTION Java
128 145 128157 DECRYPTION Java
128 145 147642 ENCRYPTION Java
Table 2: Data Set (First Set)
8
Fig. 8: Platform (Java & Node.js)
9
Fig. 10: Operation (Encryption & Decryption)
10
Fig. 12: Key Sizes (128, 192, 256 )bits
4.2. Benefits
what are the benefits of cipher block chain in picture encryption using AES algorithm?
The following are the benefits of using either the Java or Node.js platforms in CBC picture
encryption using AES128 and AES256 algorithms respectively;
11
1 Data security is ensured by using the AES technique for photo encryption, which makes it
more difficult for unauthorized users to access the information.
2. Protection of privacy: Images are encrypted using the AES algorithm and cipher block chain,
which means that only authorized users may access the encrypted data, protecting the
privacy of the people in the photos.
3. Tamper-proofing: The use of cipher block chain ensures that the encrypted pictures are
tamper-proof, as any attempt to alter the data would be immediately detected.
4. Data integrity: Since any illegal changes to the data will be discovered and stopped, the AES
algorithm makes sure that the integrity of the encrypted images is preserved.
5. Secure sharing: Encrypted images can be shared securely thanks to the cipher block chain
and AES algorithm, which limit access to the data to authorized users who possess the
necessary decryption keys.
6. Adherence to rules: By guaranteeing the security and privacy of sensitive data, encryption of
images using the AES algorithm and cipher block chain enables enterprises to adhere to
data protection regulations and standards..
5.0 Conclusion
This study used AES implementations for Java and Node.js, the two most popular web applications and
scripting languages. Data encryption and decryption using the AES algorithm in CBC mode with 128 bits,
and 256-bit keys has been tested. Experience has also shown that when it comes to online platforms, the
speed of data encryption and decryption, Java programming exceeds node.js even with lesser bits. We can
draw the conclusion that Java, as opposed to node.js, is the platform with the best effective
implementation of AES. On the other hand, the node.js AES implementation's performance fell short of
expectations with higher bits as compared to Java platform. Node.js took longer than Java to conduct the
encryption and decryption operations while utilizing a 128-bit key.AES encryption can be implemented in
web platforms using both Java and Node.js, but each has unique advantages and limitations. Java is a
good option for computationally difficult workloads because of its performance, numerous cryptography
libraries, and mature environment. On the other hand, Node.js excels at asynchronous I/O operations and
offers a more straightforward development and deployment environment. The specific needs of your
project, such as performance requirements, available libraries, and the general architecture of your
application, will determine which of the two platforms you should use.
12
References
[1] Anwarul, S., & Agarwal, S. (2017). Image enciphering using modified AES with secure key
transmission. In Communication and Computing Systems: Proceedings of the International
Conference on Communication and Computing Systems (ICCCS 2016), Gurgaon, India, 9-11
September, 2016 (p. 137). CRC Press.
[2] Wadi, S. M., & Zainal, N. (2014). High-definition image encryption algorithm based on AES
modification. Wireless personal communications, 79, 811-829.
[3] Goldberg, I., & Wagner, D. (1996). Randomness and the Netscape browser. Dr Dobb's Journal
Software Tools for the Professional Programmer, 21(1), 66-71.
[4] Auyporn, W., & Vongpradhip, S. (2015). A robust image encryption method based on bit plane
decomposition and multiple chaotic maps. Int. J. Signal Process. Syst, 3(1),
[5] Kumari, M., Gupta, S. & Sardana, P. (2017) A Survey of Image Encryption Algorithms. 3D Res 8,
37. https://doi.org/10.1007/s13319-017-0148-5
[6] Gunnsteinsson, O. (2016). A search for a convenient data encryption algorithm-For an Internet of
Things device 8-13.
[7] Node.js, “Crypto | Node.js Documentation. Available: https://nodejs.org/api/cryptohtml # crypto.
[Accessed 4 April 2021].
[8] Nita, S. L., & Mihailescu, M. I. (2022). Java Cryptography Architecture. In Cryptography and
Cryptanalysis in Java: Creating and Programming Advanced Algorithms with Java SE 17 LTS
and Jakarta EE 10 (pp. 29- 46). Berkeley, CA: Apress.
[9] Acharya, B., Panigrahy, S. K., Patra, S. K., & Panda, G. (2009). Image encryption using advanced
hill cipher algorithm. International Journal of Recent Trends in Engineering, 1(1), 663-667.
[10] Zhang,Y., Liu,W., Cao, S., Zhai, Z., Nie,X., and Dai,W.,(2009). ”Secret writing & speed sensitivity
[11] Seyed Mohammad Seyedzade, Reza Ebrahimi Atani and Sattar Mirzakuchaki, A Novel Image
Encryption Algorithm Based on Hash Function 6th Iranian Conference on Machine Vision and
Image Processing, 2010
[12] Indrakanti, S. P., & Avadhani, P. S. (2011). Permutation based image encryption
technique. International Journal of Computer Applications, 28(8), 45-47.
[13] Zahid,M., Machhout,M., Khriji,L., Baganne,A., Tourkianalyze,R., (2017) “Advanced encoding
Standard (AES)”
[14] Bani, M. A., & Jantan, A. (2008). Image encryption using block-based transformation
algorithm. IJCSNS International Journal of Computer Science and Network Security, 8(4), 191-
197.
[15] Nag, A., Singh, J. P., Khan, S., Ghosh, S., Biswas, S., Sarkar, D., & Sarkar, P. P. (2011). Image
encryption using affine transform and XOR operation. In 2011 International conference on signal
processing, communication, computing and networking technologies (pp. 309-312). IEEE.
13