[go: up one dir, main page]

0% found this document useful (0 votes)
86 views17 pages

Blockchain Practical 1-4

Uploaded by

CHEDE AACHAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views17 pages

Blockchain Practical 1-4

Uploaded by

CHEDE AACHAL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Sipna College ofof

Department Engin eeri


Computer ng &
Technol
Science & ogy,
Amravati.
Session 2022-2023 Engineering
Branch1:--Computer Sci. &
Subject::-Block Chain Engg. Lab
FundamentalsTeacher manual
Manual
Class :- Final Year
Sem :- VII

PRACTICAL NO 1
AIM: Understand basics of Block Chain and install various
practical 's software's required to perform Blockchain
INTRODUCTION TO BLOCK CHAIN:
What Is a Block chain?
Ablock chain is a distributed
database or ledger that is shared among the nodes of a
network. As a database, a block chain stores information computer
best known for their crucial role in electronically in digital format. Block chains are
decentralized record of transactions. cryptocurrency systems, such as Bitcoin, for maintaining a secure and
The innovation with a block chain is that it guarantees the
security of a record of data and generates trust vwithout the need fidelity and
fora trusted third party.
One key difference between a typical database and a block chain is how the data is
structured. A block chain
collects information together in groups, known as blocks, that hold sets of information.
storage capacities and, when filled, are closed and linked to the previously filled block, Blocks
forming
have certain
a chain of
data known as the block chain. All nevw information that follows that freshly added block is
compiled into a
newly fomed block that will then also be added to the chain once filled.
A database usually stuctures its data into tables, whereas a block chain, as its name implies, structures its
data into chunks (blocks) that are strung together. This data structure inherently makes an irreversible
timeline of data when implemented in a decentralized nature. When a block is filled, it is set in stone and
becomes
chain.
apart of this timeline. Each block in the chain is given an exact timestamp when it is added to the

Some key features of Block Chain are:


Blockchain is a type of shared database that differs from atypical database in the way that it stores
blockchains store data in blocks that are then linked together via cryptography.
information:
As new data comes in, it is entered into a fresh block. Once the block is filled with data, it is
Chained onto the previous block, which makes the data chained together in chronological orde.
Diferent tunes of information can be stored on a blockchain, but the most common use so far has
been as aledger forblockchain
In
transactions.
is used in a decentralized way so that no single person or group has
ContBirotlcoin-rather,blockchains
's case,
all users collectively retain control.
are immutable, which means that the
Decentralized data entered is ireversible. For
Bitcoin, this means that transactions are permanently recorded and viewable to anyone.
S/W REQUIRED:
software for performing the practicals
We will be using various
powerful, high-level scripting language used by many developers around a
1) Phython: Python is a a variety of real-world applications including web development
globe. The language is ideal for
scraping, and penetration testing.
How to intallPython in Ubuntu

Step 1: Setting Up Python 3

Ubuntu and other versions of Debian Linux ship with Python 3 pre-installed. To make sure that our
versions are up-to-date, update your local package index:
sudo apt update

Then upgrade the packages installed on your system to ensure you have the latest versions:
sudo apt -y upgrade

The -y flag will confirm that we are agreeing for all items to be installed, but depending on your
version of Linux, youmay need to confirm additional prompts as your system
updates and upgrades.
Once the process is complete, we can check the version of Python 3 that is
typing: installed in the system by

python3 -V
You ll receive output in the terminal window that will
let you know the version number. While this
number may vary, the output will be similar to this:
Output
Python 3.8.10
To manage software packages Python, let's install pip, a tool
for
programming packages we that will install and manage
modules or packages that youmaycanwant to use in our
development projects.
install with pip by reading How To You can learn more abou
sudo apt install -y python3-pip Import Modules in Python 3.
Python packages can be installed by
typing:
pip3 installpackage name
Here, package name can
developmnent or NumPy for refer to any Python package or
so with the command scientific computing. So if you wouldlibrary, such as Django for we
pip3 install numpy. like to install
C
There are a few more NumPy, vou can a0
for our
programmi ng packages and development tools to
sudo apt install -y environment: install to ensure that we
have a robust seuP
build-essential libssl-dev libffi-dev
CSE/SEM-VII/BCF/PRO1 python3-dev
Once Python is set up, and pip and other tools are installed, we can set up a virtual environment for
Our development projects.
Step2: Setting Up Python 3
Virtual environments enable you to have an isolated space on your server for Python projects,
ensuring that each of your projects can have its own set of dependencies that won't disrupt any of
your other projects,.

While there are a few ways to achieve a programming environment in Python, we'll be using
the venv module here, which is part of the standard Python 3 library. Let's install venv by typing:

sudoaptinstall-y python3-veny
choose which directory we
With this installed, we are ready tO create environments. Let's either new directory with mkdir, as
wouldlike to put our Python programming environments in, cor create a
in:

mkdir environments
your programming environments:
then navigateto the directorywhere you'llstore
cd environments
would like the environments to live, you can create an
where you
Once you are in the directory command:
environment by running the following
python3-m venv my env with the ls
contains a few items which we can view
Essentially, pyvenv scts up a new directory that
command:

Is my env

Output pyvenv.cfg share


bininclude lib lib64 following
you can achieve by typing the
which
this environment, you need to activate it,
To use activate script:
Command that calls the
sOUrce my env/bin/activate

environment, in this case it is


prefixed with the name of your may
prompt will
now be
Debian Linux you are running, your prefix first
of
Our command Depending on what version your environment in parentheses should be the
called my env. differently,. but the name of
appear somewhatyourline:
thing you see on
uy env) Sammy@ubuntu:-enviornmentS
new file:
text editor such as nano and create a
commandline Page 3
open up a

CSE/SEM-VII/BCE/PRO1
nano hello.py

2) Etherum:
sno
a decentralized open-source platform based on blockchain domain. used to run
Ethereum is
exactly as it was programmed without th
contracts i.e. applications that execute the program censorship, or downtime. It serves a platform
possibility of any fraud, interference from a third party, generated by ethereu
for nearly 2,60,000 different cryptocurrencies. Ether is a cryptocurrency
blockchain.
miners, used to reward for the computations perfornmed to secure the

" Ethereum VirtualMachine(EVM)


Ethereum Virtual Machine abbreviated as EVM is a runtime environment for executing smart
contracts in ethereum. It focuses widely on providing security and execution of untrusted code
using an international network of public nodes. EVM is specialized to prevent Denial-of-service
attack and confirms that the progranm does not have any access to each other's state, also ensures
that the communication is established without any potential interference.

Solidity
Solidity is a brand-new programming language created by the Ethereum which is the
market of cryptocurrency by capitalization, released in the year 2015 1ed by second-largest
Christian Reitwiessner.
Some key features of solidityare listed below:
Solidity is a high-level
o It is statically-typed programming language designed for implementing smartcontracts.
object-oriented(contract-oriented)
o Solidity is highly influenced by
Virtual Machine(EVM).
language.
Python, c+-t, and JavaScript which runs on the
Ethereum
o Solidity supports
o Solidity is primarycomplex user-defined programming, libraries and inheritance.
o Solidity can be used language for blockchains running platforms.
to creating contracts like
signature wallets, etc. voting. blind auctions, crowdfunding, mut

Smart Contract
Smart contracts are high-level
theethereum
blockchain for program codes that are compiled to
interference further
of the third party, execution. It allowS us to EVM byte code and
smart contracts are Solidity (a these perform deployed 0
credible transactions without
transactions are trackable and
Python,but deprecated), LLL (alanguage library with similarities to Cirreversible. ay
low-level Lisp-like and Languages used to wI
REMIX IDE language), and JavaScript), Serpent
Mutan (Go-based, but (similar
Remix 1DE allows
deprecated).
blockchains. It can alsodeveloping,
be used asdeploying and
The Remix is an
a
administering
learning platform. Smart contracts for
Ethereum like
Solidity programminIntegrated
g language.Devel
TheoIIDE
pmentcanEnvironment
be used (|DE)compile,
or
CSE/SEM-VI /BCF/PRO1 to write, developing
and debugsmart contractsCO
the Solidity
writtenin.
Itwas JavaScript and supports testing, debugging and
Remix-IDEcanbe
more.
accessed in many different ways: deploying smart Contracts, and much

You can use it online in


any browser
https://remix.ethereum.org
you can install it in
in the browser.
of your choice, by entering the URIL:
o Or your own system
install Remix IDE
Stepsto

Step1:
INSTALLATION:

Remix-idehas been published as an npm module


Installnpmand node.js, then do:
nnm install -g @remix-project/remixd

Step 2:
Docker

oRun this command to download the current stable release of Docker Compose:

Sudo curl -L "https://github. com/docker/compose/releases/down load/1. 29 .2/docker


Compose-$(uname -s) -$(uname -m)" -o /usr/local/bin/docker-compose

oApply executable permissions to the binary:

sudo chmod +x /usr/local/bin/docker-compose

Run with docker

docker pull remixproject/remix-ide:remix live


remixproject/remix-ide:remix live
dOCker run -p 8080:80
Step 3: Remix instance.
Ihen go to http:///ocalhost:8080 and you can use your

ofBlock Chain and installed various software's required to


CONCLUSON: we have studied basics
perform BlockchainThuspractical's

Page 5
Sipna
College ofof
Department EngiComput
neerin
erg & Technology,
Science &
Session 2022-2023 Engineering
Amravati.
Branch :-Computer Sci. &
Subject :-Block Chain Engg.
FundamentalTeacher
s Lab manual
Manual
Class :- Final Year
Sem :- VII

PRACTICAL N0 2
AIM: Implement Diffie-Hellman Algorithm
S/W REQUIRED: Phython

Diffie-Hellman algorithm
The Diffie-Hellman algorithm is being used to establish a shared secret
communications while exchanging data over a public network using the that can be used for secret
get the secret key using the parameters. elliptic curve to generate points and
For the sake of simplicity and practical
one prime Pand G (a primitive root of P)implementation of the algorithm, we will consider only 4
and two private values a and b. variables,
P and Gare bothpublicly available numbers. Users
(say Alice and Bob) pick private values a and b and they
generate a key and exchange it publicly. The opposite person receives the key and that generates a secret
key, after which they have the same secret key to
encrypt.
Step by Step Explanation

Alice Bob

Public Keys available = P, G Public Keys available = P,G

Private Key Selected = a Private Key Selected = b

Key generated = Key generated =

X-G mod P y=G mod P

Exchange of generated keys takes place


key received = x
Key received - y

Generated Secret Key = Generated Secret Key =


Kh=xmod P
K¡-y° mod P
[Type text]
Bob
Alice
that
Algebraically, it can be shown
Ka-Kb

encrypt
symmetric secret key to
Users now have a

Example:
numbers P = 2.3, G=9
Step 1:Alice and Bob get public
and
Step 2: Alice selected a private key a = 4
Bob selected a private key b=3

Step 3:Alice and Bob compute public values


Alice: x -(9^4 mod 23) = (6561 mod 23) = 6
Bob: y=(9^3 mod 23) = (729 mod 23) = 16

Step 4: Alice and Bob exchange public numbers

Step 5: Alice receives publickey y =16 and


Bob receives public key x =6

Step 6: Alice and Bob computesymmetric keys


Alice: ka = y^a mod p = 65536 mod 23 =9
Bob: kb =x^bmod p =216 mod 23 =9
Step 7: 9 is the shared secret.

Implementation:

from random import randint


if name main

a # Both the persons willbe agreed upon the


# public keys G and P
# A prime numberP is taken
P=23

#A primitive root for P. G is taken


G=9

print(The Value of P;is


print(The Valuee of G :%d'%(P))
is:%d%(G))
CSE/SEM-V/BCF/PR02 Page
2
Spe
text)
a
choose the private key
#Alice will
a =4 Alice is :%d%(a)
print('The Private Key afor
generatedkey
#xgets the
=int(pow(G.a,P))

the private key b


#Bob will choose
b=3 Bob is :%d%(b)
print('The Private Key bfor

thegenerated key
#gets
y= int(pow(G,5,P))

for Alice
# Secretkey P))
int(pow(y,a,
ka=
for Bob
# Secret key
P))
kb =int(pow(x, b,
is :%d'%(ka)
print('Secret key for the Alice :%d'%(kb))
print(Secret Keyfor the Bob is

Output:
The value of P: 23
The value of G:9

The private key a for Alice : 4


The private keybfor Bob:3
Secret key for the Alice is :9
Secret Key for the Bob is:9

Diffie-Hellman Algorithm.
implemented a
CONCLUSION: Thus we have

CSE/SEM-V/BCF/PR02
Sipna College of
DepartmentofEngineering
Computer
&
Technology,
Science &
Amravati.
Session 2022-2023 Engineering
Branch:-Computer Sci. &Engg,
Subject :-Block Chain
FundamentalsTeacher
Lab manual
Manual
Class :- Final Year
Sem :- VII

PRACTICAL NO 3
AIM: Implement various SHA algorithms
SW REQUIRED: Phython

SHA (Secure Hash Algorithms )


SHA stands for secure hashing algorithm. SHA is a
information and certificates. A hashing algorithm shortens modified version of MD5 and used for hashing
the input
operations, modular additions, andinformation
oannot be learned by utilizing bitwise into a smaller form that
compression functions.
SHAS also help in revealing if an original message was
hash digest, a user can tellif even an individual letter has transformed in any way. By imputing the original
different.
been shifted, as the hash digests will be effectively

The important element of SHAs are that they are


deterministic. This define that consider the hash function
used is known, any computer or user can regenerate the hash digest. The
main reasons that each SSL certificate on the Internet is needed to have been determinism of SHAS is one of
hashed with a SHA-2 function.
SHA, (Secure Hash Algorithms ) are set of cryptographic hash functions defined by
for various applications such as password security etc. Some variants of it the language to be used
are supported by Python in the
"hashlib library. These can be found using "algorithms guaranteed' function of hashlib.
SHA Hash
Ihe different SHA hash functions are explained below.

1. SHA256 : This hash function belong to hash class SHA-2, the internal block size of it is 32 bits.

2. SHA384:This hash function belong to hash class SHA-2, the internal block size of it is 32 bits. This
IS one of the truncated version.

3. :: This hash function belongto hash class SHA-2,the internal block size
SHA224
IS oneof the truncated
of it is 32 bits. This
version.
4. SHA5 12 :This hash function belong to hash class SHA-2, the internal block size of it is 64 bits.

5. SHA:The l60 bit hash function that resembles MD5 hash in working and was discontinued to be
used seeing its security vulnerabilities.
Implementation:
demonstrate
# Python 3 code to
# SHA hash algorithms.
import hashlib
#initializing string
str ="SIPNACOET"

#encoding SIPNA COETusing


encode()
# then sending to SHA256)
result = hashlib.sha256(str.encode()
value.
# printing the equivalent hexadecimal SHA256
print("The hexadecimal equivalent of is : ")
print(result.hexdigest()
print ("r")
# initializing string
str ="SIPNACOET"

# encoding SIPNA COETusing encode)


#then sending to SHA384)
result = hashlib.sha384(str.encode)

# printing the equivalent hexadecimal value.


print("The hexadecimal equivalent of SHA384 is :")
print(result.hexdigest())
print ("r")
# initializing string
VI str ="SIPNACOET"

#encoding SIPNA COETusing encode()


# then sending to SHA224)
result = hashlib.sha224(str.encode))
MIS
# printing the equivalent hexadecimal value.
print("The hexadecimal equivalent of SHA224 is :")
print(result.hexdigest()
print ("r")
# initializing string
str =*SIPNA COET"

# encoding SIPNA
# then sending to COETusing encode()
SIHAS120
result = hashlib.sha512(str.encode())

CSE/SEM-V/BCF/PRO3
Page 2
equivalenthexadecimal value.
the
print("The
printing hexadecimal equivalent of SHAS12 is: ")
!
print(result.hexdigest())

print("r")
#initializingstring
SIPNACOET"
str=
encoding ,SIlPNACOETusing encode()
# sendingtoSHA1)
#then hashli.shal (str.encode()
result=
equivalent hexadecimal value.
# printingthe
print("The hexadecimal equivalent of SHA1 is:")
print(result.hexdigest()

Output:
s9\hello\SHA algorithms.py
The hexadecimal equivalent of SHA256 is :
ebe3f7219907ff819e1fbae2327f25f85158114309f6cff1f48fcf3259c30784
The hexadecimal equivalent of SHA384 is :

dse62h881gh089ec7929933b6fc1928dd64b5df31bcde6381b9d3f90438d253248490460C9a5a1a873da8236C12ef9b3
The hexadecimal equivalent of SHA224 is :
173994f309f727ca939bb185036cd7b36e66141c9e52ba0bdcfd145d
The hexadecinal equivalent of SHAS12 is :
edsfts370a5bf7b92be4865cdf8b658a82209624e33ed7ICAe353bYdf254Y75db63d1ba35ad99fF26f1b399C31f3cG66a7f c67ecef3bdcdb7d6eedaa
9eb722

The hexadecimal equivalent of SHA1 is :


4175a37afd561152fb60c305d4fa6026b7e79856

CONCLUSION: Thus we have implemented various SHA algorithms.

Page 3

CSE/SEM-V/BCF/PR03 ey(d =2011)


Sipna College of
Department ofEngineering
Computer
&
Technology,
Science &
Amravati.

Session 2022-2023 Engineering


Branch :-Computer Sci. & Engg.
Subject :-Block Chain Class :- Final Year
FundamentalsTeacher Manual
Lab manual Sem :- VII

PRACTICAL N0 4
AIM: Implement RSA Encryption and
Decryption
S/W REQUIRED: Phython

Rivest-Shamir-Adleman(RSA)
pSA abbreviation is
decrypt messages. t 1SRivest-Shamir--Adleman.
This algorithm is used by
an asymmetric cryptographic algorithm which meansmany that
companies to encrypt and
ie.. the public key and the private key. This is also known as there are two different keys
keys can be given to anyone. Companies such as Acer, Asus, HP, public-key cryptography because one of the
their products. Lenovo, etc., use encryption techniques in
How does RSA algorithm work?
let us learn the mechanism behind RSA algorithm by
considering one example :
1. Generating Public Key :

Select two prime no's. Suppose P = 53 and Q = 59.


Now First part of the Public key :n = P*Q = 3127.
We also need a small exponent say e:
But e Must be

An integer.

Not be a factor of n.

I<e<o(n) [O(n) is discussed below].


Let us now consider it to be equal to 3.

Our PublicKey is made of n and e


2. Generating Private Key :
We need to calculate D(n):
Such that O(n) = (P-1 )(Q-1)
So, (n) = 3016

Now calculate Private Key, d:


d (k*D(n) + 1)/e for some integer k
For k= 2, value off dis 2011. =3) and Private Key(d =2011)
3. Public Key (n =3127 and e
Now We are ready with our
encrypt HI" :
4. Now we will
numbers :H =8and I =9
Convert letters to
c = 89e mod n.
Thus Encrypted Data comes out to be 1394
Encrypted Data
Thus our

decrypt 1394 :
5. Now wewill
n.
Decrypted Data = cd modcomes
Data out to be 89
Thus our Encrypted
"HI".
8 = H and I = 9 i.e.

Implementation:

import math
print("RSA ENCRYPTOR/DECRYPTOR") *** * *)
**** *** ********
**************k
nrint("****** ** * *** ***

#Input Prime Numbers


'q' VALUES BELOW: ")
print("PLEASE ENTER THE 'p' AND
number for p: "))
p= int(input("Enter a prime number for q:"))
q= int(input("Enter a prime
******** )
**************** * * * * *
nint(1****** ******** ** * * ** ***

FUNCTION CHECKS WHETHEK


#Check if Input's are PrimeTHE CODE IMMEDIATEL Y BELOW THE
THIS FUNCTION AND OR NOT."
PRIME
THE INPUTSARE
def prime check(a):
if(a=-2):
return True
elif(a<2) or ((a%2)=-0)):
return False
elif(a>2):
for í in range(2,a):
if not(a%i):
return false
return True

check_p-prime_check(p)
check_q - prime_check(q)
while((check p==False)or(check_q-False))):
"))
p=int(input("Enter aprime number for p:"))
number for q:
q= int(input("Enter aprime
check p= prime check(p)
check q= prime check(q) Page2

CSE/SEM-V/BCF/PR04
RSAModulus
"CALCULATIONOF RSA MODULUS 'n'"
17p*q
("RSA Modulus(n) is:",n)
print
EulersToitent
CALCULATION OF EULERS TOITENT T"
rp-l)*(q-l)
print("Eulers Toitent(r) is:"r)
int(********************.

GCD
"CALCULATION OF GCD FOR 'e' CALCULATION,"
defegcd(e.r):
while(r!=0):
e,rFr,e%r
return e

#Euclid's Algorithm
defeugcd(e,r):
for iin range(1.r):
while(e!=0):
a.b=r/le.r%e
if(b!-0):
print("%d =%d*(%d) + %d"%(r.a.e.b))
Fe
e-b

#Extended Euclidean Algorithm


def eea(a.b):
ifla%b=-0):
return(b.0,1)
else:
gcd.s,t = eea(b,a%b)
S=s-(a//b) * )
print("%d =%d*(%d) +(%d)*(%dy"%(gcd, a,t,s,b))
return(ged.ts)

#Multiplicative Inverse
def mult inv(e.r):
gcd,s, =eea(e.r)
if(ged!=1):
return None
else:
s-od."%(s,s,s%r)
if(s<0): 0, s= s(modr), i.e.,
print("'s=%d. Since %d is less than
elif(s>0):
print("'s=%d."%(s))
return s%r

#e Value Calculation BETWEEN 1 and 1000 THAT MAKES (e,r)


POSSIBLE VALUE OF 'e'
"FINDS THE HIGHEST
COPRIME," Page 3

CSE/SEM-V/BCF/PR04
for i in range(1,1000):
if(egcd(i,r--1):
e-i
print("The value ofe is:".e) ***********)
****** **
print(1 k**** ***** *****

#d, Private and Public Keys


PUBLIC KEY,"
"CALCULATION OF 'd', PRIVATE KEY, AND
print("EUCLID'S ALGORITHM:")
eugcd(e.r) ACHIEVE EUCLID'S ALGORITHM.'")
print("END OF THE STEPS USED TO
***** * ********k * ****** *
***** * )
nrint**** ***** ***** ***** *****
print("EUCLID'S EXTENDED ALGORITHM:")
d= mult inv(e.r) VALUE OF 'd'.")
print("END OF THE STEPS USED TO ACHIEVE THE
print("The value of d is:",d)
*********************** ********* * *** * * *** ** ** * ***")
print(":1****
public = (e.n)
private =(d,n)
print("Private Key is:",private)
print("Public Key is:",public) ** ***** ********* I)
**
nrint(1************ ********** ** ** **** * ****

#Encryption
"ENCRYPTION ALGORITHM.""
def encrypt(pub_key,n _text):
e,n-pub key
x=]
m=0
for i in n text:
if(i.isupper():
m =ord(i)-65
c-(m**e)%n
X.append(c)
elif(i.islower()):
m= ord(i)-97
c-(m**e) %n
X.append(c)
elif(i.isspace()):
spe-400
X.append(400)
returnX

#Decryption
"DECRYPTION ALGORITHM"
def decrypt(priv key,c_text):
d,n=priv_ key
txt-c text.split(, )
X="
m=0
for iin txt:
if(i==400): Page4

CSE/SEM-V/BCF/PR04
else:
m-(int(i)* *d) %n
m+=65
c=chr(m)
X+=c
return x

EMessage
2ne= input("What would you like encrypted or
print("Your message is:"message) decrypted2(Separate numbers with' for decryption):")
Choose Encrypt or Decrypt and Print
choose =input("Type '1' for encryption and '2'
ilchoose-=l): for decryption.")
enc msg=encrypt(public,message)
print("Your encrypted message is:",enc msg)
nrint("Thank you for using the RSA Encryptor. Goodbye!")
eifl choose-2):
nrint("Your decrypted message
else:
is:",decrypt(private,message))
print("Thank you for using the RSA Encryptor. Goodbye!")
print("You entered the wrong option.")
print("Thank you for using the RSA Encryptor. Goodbye!")
Output:
RSA ENCRYPTOR/DECRYPTOR
$****************** **** ****%**** ****%**** *
PLEASE ENTER THE 'p' AND 'q' VALUES BELOW:
Enter a prime number for p:3
Enter a prime number for q: 5
$**************k********%*********k **
RSA Modulus(n) is: 15
Eulers Toitent(r) is: 8
**********%***% %%********** *****
he value of e is: 999
$******** *;*
EUCLID'S ALGORITHM:
8=0*(999)
999 = +8
124*(8)1 +7
8=1*(7)+
END OF THE STEPS USED TO ACHIEVE EUCLID'S ALGORITHM,.
EUCLID'S+(-1y(7)
=8*(1) EXTENDED ALGORITHM;
=999*(-1l) +(125)*(8)
S--1.
END SiOFnce -1 is less than 0, s= s(modr), i.e.,s7.
The THE STEPS USED TO ACHIEVE THE
value of d is:1 VALUE OF 'd,

Priviatce Key is: (7, 15)


Publ Key is: (999, 15)
CONCLUSION: Thus we have implemented RSA Encryption and Decryption.

CSE/SEM-V/BCF/PR04
Page6

You might also like