FALL SEMESTER-2020-2021: Cse3501-Information Security Analysis and Audit

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

FALL SEMESTER-2020-2021

CSE3501-INFORMATION SECURITY ANALYSIS AND


AUDIT

LAB ASSIGNMENT-8
NAME : K.SAI CHARAN
REG.NO : 17MIS0419
SLOT : L47+L48
FACULTY : CHANDRASEGAR.T

TEAM MEMBERS:

1.17MIS0436- V.HARI CHARAN


2.17MIS0395- S.KHALID SHARIF
PROTECTING BIG DATA USING INTELLIGENT CRYPTOGRAPHY:
Code:
import random
print("")
print("***Safe Store in cloud using Intelligent Cipher Technique***")
f=open("Input.txt", "r")
if(f.mode=='r'):
d =f.read()

f.close()
d=d.strip()
print("File Information read successfully ",d)
y=int(input("Enter division number to divide the info :")) #5650
c=bin(y)[2:].zfill(len(d))

r=bin(int(d,2)-int(c,2))[2:].zfill(len(d))
print("")
print("Information after division to two parts :",r," ",c)
key=bin(random.randrange(y,int(d,2)))[2:]
print("Random key Generated is :",key)

printf(“”)

cloudA=bin(int(c,2)^int(key,2))[2:].zfill(len(d))
cloudB=bin(int(r,2)^int(key,2))[2:].zfill(len(d))
print("--Information Storage Process--")
f= open("Encrypted_cloudA.txt","w+")
f.write("Encrypted Information in cloud A:")
f.write(cloudA)

f.close()
print("Information successfully stored in
Encrypted_cloudA.txt file ");print("")
f= open("Encrypted_cloudB.txt","w+")

f.write("Encrypted Information in cloud B:")


f.write(cloudB)
f.close()
print("Information successfully stored in Encrypted_cloudB.txt file ")
print("")
print("--Information Retrieval Process--")
cloudAretrieval=bin(int(cloudA,2)^int(key,2))[2:].zfill(len(d))
cloudBretrieval=bin(int(cloudB,2)^int(key,2))[2:].zfill(len(d))
print("Info successfully retrieved from clouds ");print("")
sum=bin(int(cloudAretrieval,2)+int(cloudBretrieval,2))[2:].zfill(len(d))
sum1=bin(int(sum,2)^int(key,2))[2:].zfill(len(d))
original=bin(int(sum1,2)^int(key,2))[2:].zfill(len(d))
f= open("Decrypted.txt","w+")
f.write("Decrypted Information is:")
f.write(original)

f.close()
print("Decrypted Information successfully stored in Decrypted.txt file ");print("")
if(original==d):

print("---Technique Successful---
else:
print("---Technique failed---")
Output:
Here we are taking input Binary number to be stored in cloud in Input.txt (1KB)
file and Two intermediate files will be created during execution for storing data
that is stored in encrypted fomat in cloud.i.e Encrypted_cloudA.txt and
Encrypted_cloudB.txt and the output file with output binary number will be
created afterdecryption of cloud a and b data as Decrypted.txt.
Before execution : only input file given

After execution : 3 files will be


created.Encrypted_cloudA.txt,Encrypted_cloudb.txt and Decryptrd.txt.
Input file and created Decrypted.txt file(Input.txt , Decrypted.txt)

Data stored in two cloud Encrypted files: (Encrypted_cloudA.txt , Encrypted_cloudB.txt)

You might also like