You are on page 1of 13

VISUAL CRYPTOGRAPHY IN

ONLINE TRANSACTIONS

Course Instructor :-
Prof. Manish K. Gupta

Group :-

Kamal Patel (202001018) Latex Report, PPT


Aditya Patel (202001020) PPT
Shrey Pobaru (202001021) Video
Nishith Gangajaliya (202001024) Video
Chintan Suthar (202001242) Latex Report, Code
Rahil Shukla (202001418) Video

Dhirubhai Ambani Institute of Information and Communication


Technology

1
Contents
1 Introduction 4

2 Visual Cryptography 4
2.1 What is visual cryptography? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 How visual cryptography works? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Advantages and disadvantages of visual cryptography . . . . . . . . . . . . . . . . . . . . . . 9
2.3.1 Advantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.2 Disadvantages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3 Applications of Visual Cryptography in Online Transactions 10


3.1 Images used in visual cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Real-life applications of visual cryptography in online transactions . . . . . . . . . . . . . . . 10
3.3 Existing system and its description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4 System using visual cryptography and its description . . . . . . . . . . . . . . . . . . . . . . . 12

4 Limitations of Visual Cryptography 13

5 Future of Visual Cryptography in Online Transactions 13

2
1 Introduction
Online transactions are an integral component of every day life as the world gets more digital. Online
purchases are handy however they also come with a risk of fraud and online crimes. To address this issue,
various methods of secure transactions have been developed, including encryption and digital signatures.
Visual cryptography is one innovative technique for ensuring online transactions are secure.

Visual cryptography is a cryptographic technique that allows for the secure transmission of information
through visual means. It uses the properties of human vision to encrypt information, making it unreadable
to anyone without the appropriate decoding tools. Due to its potential for application in safe online trans-
actions, visual cryptography has attracted a lot of attention recently.

The idea of visual cryptography and how it is used in online transactions will be covered in this piece
of writing. We will investigate the application of visual cryptography to strengthen online transaction secu-
rity and increase their resilience to online attacks. We will also look at drawbacks and potential advancements
in the future.

2 Visual Cryptography
2.1 What is visual cryptography?
Visual cryptography is a method of encoding a secret message into a number of pictures or images also called
shares to enable the secret sharing of information. The shares are given out to various people, and the secret
message is revealed only by carefully combining the shares. Pixel expansion, which is the method of storing
one bit of secret information in numerous pixels of two or more shares, is the foundational idea of visual
cryptography. To someone who is unaware of the secret, the generated images seem random and meaningless,
but when the shares are superimposed, the original hidden message is revealed. Secure image transmission,
digital watermarking, and secure authentication are just a few of the uses for visual cryptography.

2.2 How visual cryptography works?

Encryption Function ( Python Code )

1. User Provide image that Need to be Encrypted


2. We turn it into a binary image with the bits 0 and 1 on it.

Listing 1: preparing an image for encryption

import numpy a s np

def e n c r y p t ( img ) :
width , h e i g h t = img . s i z e

# t h r e s h o l d v a l u e f o r b i n a r i z a t i o n o f image
t h r e s h o l d = 128

3
# B i n a r i z e image
img = b i n a r i z e ( img , t h r e s h o l d )

# s h a r e 1 and s h a r e 2
share1 = [ ]
share2 = [ ]
fo r x in range ( h e i g h t ) :
s h a r e 1 . append ( [ ] )
s h a r e 2 . append ( [ ] )

# Convert image i n t o numpy a r r a y


img = np . a s a r r a y ( img )

3. Now we will convert original image to 2 Image using original image and randomised varible z.
4. This 2 image individually do not contain any information.

Listing 2: Encryption Algorithm

fo r x in range ( h e i g h t ) :
fo r y in range ( width ) :

# S e l e c t i n g random number 0 or 1
z = randint (0 ,1)

# Encryption algorithm
i f ( img [ x ] [ y ]==1):
i f ( z ==1):
share1 [ x ] . i n s e r t (y , 1 )
share2 [ x ] . i n s e r t (y , 1 )
else :
share1 [ x ] . i n s e r t (y , 0 )
share2 [ x ] . i n s e r t (y , 0 )
else :
i f ( z ==1):
share1 [ x ] . i n s e r t (y , 1 )
share2 [ x ] . i n s e r t (y , 0 )
else :
share1 [ x ] . i n s e r t (y , 0 )
share2 [ x ] . i n s e r t (y , 1 )

#C o n v e r t i g s h a r e 1 & s h a r e 2 i n t o numpy a r r a y
s h a r e 1 = np . a s a r r a y ( s h a r e 1 )
s h a r e 2 = np . a s a r r a y ( s h a r e 2 )

4
5. Again we are Converting Both share 1 and share 2 to greyscale image.
6. Since both together contain information, we do not store two shares on the same space. Instead, we
typically provide the user 1 share (using the same algorithms as the locker).

Listing 3: Binary to greyscale ( Python Code )


# Convert numpy a r r a y t o image
s h a r e 1 = Image . f r o m a r r a y ( s h a r e 1 )
s h a r e 2 = Image . f r o m a r r a y ( s h a r e 2 )

# Convert t h e s h a r e s from b i n a r y image t o normal image ( 0 , 2 5 5 )


width , h e i g h t = s h a r e 1 . s i z e
fo r x in range ( width ) :
fo r y in range ( h e i g h t ) :
i f s h a r e 1 . g e t p i x e l ( ( x , y ) ) == 1 :
share1 . putpixel (( x , y ) ,255)
else :
share1 . putpixel (( x , y ) ,0)

i f s h a r e 2 . g e t p i x e l ( ( x , y ) ) == 1 :
share2 . putpixel (( x , y ) ,255)
else :
share2 . putpixel (( x , y ) ,0)

return s h a r e 1 , s h a r e 2

What we have as Encryption output ( Image )

1. Share 1 2. Share 2

• One share will be with User while other will be stored to system.

• how to superimpose this 2 image to get our original back is explained in Decryption function below.

5
Decryption Function ( Python Code )

1. We First convert Grey scale encrypted (Share 1 and Share 2) to binary image in order to process
throughout Decryption algorithm.

Listing 4: preparing an image for Decryption

def d e c r y p t ( s h a r e 1 , s h a r e 2 ) :
width , h e i g h t = s h a r e 1 . s i z e

# Convert t h e s h a r e s from normal image t o b i n a r y image ( 0 , 1 )


fo r x in range ( width ) :
fo r y in range ( h e i g h t ) :
i f s h a r e 1 . g e t p i x e l ( ( x , y ) ) == 2 5 5 :
share1 . putpixel (( x , y ) ,1)
else :
share1 . putpixel (( x , y ) ,0)

i f s h a r e 2 . g e t p i x e l ( ( x , y ) ) == 2 5 5 :
share2 . putpixel (( x , y ) ,1)
else :
share2 . putpixel (( x , y ) ,0)

2. We then Superimpose Share 1 and Share 2 following below Rules to get back orignal image in binary
Form.

Listing 5: Decryption Algorithm


# d e c r y p t e d image
decrypted = [ ]
fo r x in range ( h e i g h t ) :
d e c r y p t e d . append ( [ ] )

# Convert image i n t o numpy a r r a y


s h a r e 1 = np . a s a r r a y ( s h a r e 1 ) . t o l i s t ( )
s h a r e 2 = np . a s a r r a y ( s h a r e 2 ) . t o l i s t ( )

# Decryption algorithm
fo r x in range ( h e i g h t ) :
fo r y in range ( width ) :
i f ( s h a r e 1 [ x ] [ y]== s h a r e 2 [ x ] [ y ] ) :
decrypted [ x ] . i n s e r t (y , 0 )
else :
decrypted [ x ] . i n s e r t (y , 1 )

6
3. Again we are Converting Decrypted image to greyscale.
4. We have decrypted Image which can be compare from below image.

Listing 6: Binary to Greyscale image


# Convert d e c r y p t e d a r r a y i n t o image
d e c r y p t e d = np . a s a r r a y ( d e c r y p t e d )
d e c r y p t e d = Image . f r o m a r r a y ( d e c r y p t e d )

# Convert t h e d e c r y p t e d image from b i n a r y image t o normal image ( 0 , 2 5 5 )


decrypted = debinari ze ( decrypted )
return d e c r y p t e d

What we have as Decryption output ( Image )

1. Decypted Photo 2. Original Photo

• For Decryption we asked user to provide Share 1.


• Then we superimpose it with Share 2 which we already have in order to get back our original image.

how it is implemented?

While implementing visual cryptography, a secret message is encoded into several shares or images using
pixel expansion. The shares are distributed to various people, and the secret message is revealed only by
carefully combining the shares. How visual cryptography works is as follows:
1. Encoding the Secret Message: The secret message is broken up into bits, and each bit is encoded via
pixel expansion into two or more shares. Encoding numerous pixels of two or more shares with a single
secret bit of information is referred to as "pixel expansion." To someone who does not know the secret,
each sharing is a black-and-white image that seems random and meaningless.
2. Distributing the Shares: The shares are distributed to different individuals. A two-out-of-two visual
cryptography technique, for instance, distributes one share to each person, and the secret message can
only be decoded by superimposing the two shares.

7
3. Superimposing the Shares: The individuals superimpose the shares by overlaying them on top of each
other to reveal the secret message. The original hidden message may be seen when the shares are lined
up properly, while the remaining pixels appear random and meaningless.

2.3 Advantages and disadvantages of visual cryptography


Visual cryptography is a cryptographic technique that offers several advantages and disadvantages. Here are
some of the key advantages and disadvantages of visual cryptography.

2.3.1 Advantages
1. Simple and easy to implement: Visual cryptography is a simple and easy-to-implement cryptographic
technique that does not require complex algorithms or keys.
2. No computational resources needed: Unlike other cryptographic techniques, visual cryptography does
not require any computational resources, making it ideal for use in low-resource environments.
3. No risk of key exposure: Visual cryptography does not require the use of a secret key, which eliminates
the risk of key exposure or loss.

4. No mathematical expertise required: Visual cryptography does not require any mathematical expertise,
making it accessible to a wide range of users.
5. Robustness: Visual cryptography is robust against brute-force attacks and other forms of cryptographic
attacks.

2.3.2 Disadvantages
1. Increased storage and transmission requirements: Visual cryptography requires multiple shares, which
increases the storage and transmission requirements in large scale.
2. Limited secret message size: The size of the secret message that can be encrypted using visual cryp-
tography is limited by the number of shares used.

3. Vulnerable to attacks: Visual cryptography is vulnerable to attacks that can reveal the secret message
if an attacker has access to a sufficient number of shares.
4. Limited applications: Visual cryptography is limited to applications that require the sharing of visual
information, such as images or text.

5. Low level of security: Visual cryptography provides a low level of security compared to other crypto-
graphic techniques, such as public-key cryptography or symmetric-key cryptography.

Overall, visual cryptography is a simple and easy-to-implement cryptographic technique that is suitable
for certain applications. However, it is important to carefully consider its limitations and vulnerabilities
when selecting a cryptographic technique for a particular application.

8
3 Applications of Visual Cryptography in Online Transactions
Here is the breif explanations of how visual cryptography can be used in different ways in online transactions.

3.1 Images used in visual cryptography

1. QR codes: These are 2D barcodes that encode


text, URLs, and other types of data. A smart-
phone or QR code scanner can read them. By
dividing the data into two or more QR codes and
delivering them independently, QR codes can be
utilised as a type of visual cryptography. Only
when the QR codes are properly combined can
the original data be decoded.

2. Colored squares: This approach involves creat-


ing a grid of coloured squares out of an image. To
encrypt the secret information, each square has
pixels that are either black or white. The origi-
nal image can be seen when the coloured squares
are overlapped.

3. Random dots: This technique uses a set of ran-


domly generated black and white dots to encode
information. When the two images are overlaid,
the original image is revealed.

3.2 Real-life applications of visual cryptography in online transactions

1. Secure authentication: Users can be safely


authenticated during online transactions using
visual cryptography. For instance, banks might
employ visual cryptography to offer clients a safe
login process, requiring the user to correctly over-
lay two images in order to access their account.

9
2. Password protection: It is possible to utilise
visual cryptography to secure passwords when
making purchases online. For instance, a website
might divide a password into two or more photos
and send them to the user’s email or phone using
visual cryptography. The password can then be
revealed by appropriately combining the photos.

3. Transaction confirmation: During online


shopping, visual cryptography can be used to
verify transactions. A consumer might receive a
series of photos, for instance, that they must cor-
rectly overlay in order to verify their purchase.

3.3 Existing system and its description

flow diagram
1. Login system: The user logs into the online platform using their login credentials to access their
account.
2. Visit store and add items to cart: The user browses the online store and adds items to their cart.
3. Add card no and other information: The user provides their payment information, such as credit card
number, billing address, and other details required for payment processing.
4. Information checking in payment portal: The payment portal checks the validity of the user’s payment
information, ensuring that the information is accurate and matches the user’s billing information.
5. Account verification in bank: Before processing the payment, the user’s bank verifies their account to
ensure there are sufficient funds and that the payment is authorized. Merchant receives a payment
capture token from the payment portal. A payment capture token is a sign that the merchant has been
authorised to accept payments.
6. Transfer of funds: The user selects the items they want to purchase and initiates a payment to the
merchant by transferring funds from their account to the merchant’s account.
7. To request payment for a purchase, a merchant provides the payment capture data they obtained from
the payment portal. The payment portal verifies the data the merchant supplied for payment capture.
The payment is sent to the retailer if it is verified by the payment portal.

10
• Drawbacks : The consumer is unsure with the mentioned existing payment method if his PIN number
and CVV number are forwarded to the merchant’s webpage. One must have faith in the vendor and its
cardholder data to be used by staff members for personal gain. High level security is not supported by
this illustration. The merchant may be required to comply with PCI standards as part of the solution,
but this would take time.

3.4 System using visual cryptography and its description

flow diagram

1. Login system: The user logs into the online platform using their login credentials to access their
account.
2. Visit store and add items to cart: The user browses the online store and adds items to their cart.

3. Add card no and other information: The user provides their payment information, such as credit card
number, billing address, and other details required for payment processing.
4. Creation of two shares using visual cryptography: The user’s payment information is encrypted using
visual cryptography, which generates two shares. One share is kept by the user, and the other share is
sent to the CA.

5. Keep one share to user and send another to CA: The user keeps one share, while the other share is
sent to the CA to ensure secure decryption of the payment information.
6. Certified authority: The CA verifies the user’s information and decrypts the user’s share using their
own share and the user’s share to retrieve the payment details.

7. CA gets information by doing decryption using his share and user’s share: A certified authority (CA)
is involved in the transaction to ensure security. The user’s information is encrypted using visual
cryptography, which generates two shares. One share is kept by the user, and the other share is sent
to the CA. CA decrypts the information using his share and user’s share.
8. Transferring funds from customer’s account to merchant’s account: The user selects the items they
want to purchase and initiates a payment to the merchant by transferring funds from their account to
the merchant’s account.

11
4 Limitations of Visual Cryptography

• Limited information storage capacity: Vi-


sual cryptography’s information storage capacity
is limited in comparison to other methods of en-
cryption. This is because visual cryptography
depends on the distribution of shares, and the
more shares used to recreate the original image,
the larger the file size gets. This can make it
challenging to use visual cryptography to encrypt
large amounts of data.

• Limited scalability: Visual cryptography has a


limited ability to scale, making it potentially im-
practical for use in large-scale applications. For
instance, it can be challenging to implement on a
large scale when shares are distributed to a lot of
individuals since it can become quite complicated
and time-consuming.

• Vulnerability to attacks: Visual cryptogra-


phy can be the target of specific kinds of attacks.
To change the final image or information, an at-
tacker might, for instance, attempt to edit or dis-
tort one or more of the shares. Furthermore, a
hacker could attempt to intercept or steal one or
more of the shares, compromising the security of
the original data.

5 Future of Visual Cryptography in Online Transactions


Visual cryptography is new field and there is so much potential for further developments in the future. Some
of the potential advancements are described below.
• Improved encoding techniques: As computing power and data storage capabilities continue to im-
prove, there may be opportunities to develop more complex and secure encoding techniques for visual
cryptography.
• Integration with biometrics: Biometric authentication, such as fingerprint or facial recognition, could
be integrated with visual cryptography to create more robust and secure authentication methods.
• Integration with artificial intelligence: Artificial intelligence and machine learning could be used to
analyze and interpret visual cryptography images, improving the speed and accuracy of decoding.
• Development of scalable visual cryptography techniques: Currently, visual cryptography has limitations
in terms of the amount of information that can be encoded and the scalability of the technique. Future
advancements could help to address these limitations and make visual cryptography more practical for
a wider range of online transactions.

12
References
[1] Trihastuti Yuniati and Rinaldi Munir. Secure e-payment method based on visual cryptography. In 2018
3rd International Conference on Information Technology, Information System and Electrical Engineering
(ICITISEE), pages 130–135, 2018.
[2] Souvik Roy and P. Venkateswaran. Online payment system using steganography and visual cryptography.
pages 1–5, 03 2014.
[3] E –payment system using visual and quantum cryptography. Procedia Technology, 24:1623–1628, 2016.
International Conference on Emerging Trends in Engineering, Science and Technology (ICETEST - 2015).

[4] Wikipedia contributors. Visual cryptography — Wikipedia, the free encyclopedia, 2022. [Online; accessed
1-May-2023].

13

You might also like