Skip to content
Permalink
Browse files
Add files via upload
  • Loading branch information
bhusala committed Jul 24, 2020
0 parents commit 86107ced45bee9a2096f2553e73e1bf43bb690aa
Show file tree
Hide file tree
Showing 5 changed files with 1,099 additions and 0 deletions.
@@ -0,0 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30204.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "encrypting files", "encrypting files\encrypting files.pyproj", "{C8D0C857-6D10-4368-861B-5748463AE31B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8D0C857-6D10-4368-861B-5748463AE31B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8D0C857-6D10-4368-861B-5748463AE31B}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {598256B5-8750-4128-BB65-297D26E34251}
EndGlobalSection
EndGlobal
@@ -0,0 +1,35 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>c8d0c857-6d10-4368-861b-5748463ae31b</ProjectGuid>
<ProjectHome>.</ProjectHome>
<StartupFile>encrypting_files.py</StartupFile>
<SearchPath>
</SearchPath>
<WorkingDirectory>.</WorkingDirectory>
<OutputPath>.</OutputPath>
<Name>encrypting files</Name>
<RootNamespace>encrypting files</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
</PropertyGroup>
<ItemGroup>
<Compile Include="encrypting_files.py" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
<!-- Uncomment the CoreCompile target to enable the Build command in
Visual Studio and specify your pre- and post-build commands in
the BeforeBuild and AfterBuild targets below. -->
<!--<Target Name="CoreCompile" />-->
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
</Project>
@@ -0,0 +1,40 @@
from cryptography.fernet import Fernet

def create_key():
key = Fernet.generate_key()

with open("key.key","wb") as filename:
filename.write(key)

def load_key():
return open("key.key","rb").read()

def file_encryption(file):
f = Fernet(load_key())

file_data = open(file,"rb").read()
encrypted = f.encrypt(file_data)

with open(file,"wb") as filename:
filename.write(encrypted)

def file_decryption(file):
f = Fernet(load_key())

file_data = open(file,"rb").read()
decrypted = f.decrypt(file_data)

with open(file,"wb") as filename:
filename.write(decrypted)

#for 1st time, uncomment this:
#create_key()
file = r"C:\Users\Dell\Desktop\file encryption\encrypting files\files\Sample1000.csv"
#file_encryption(file) #for encryption
#print("Hello, starting encryption..")
file_decryption(file)





@@ -0,0 +1 @@
6qCY8DyfL49b76LBmnXJnNjRuZAgQjupR90uxC-sM4I=

0 comments on commit 86107ce

Please sign in to comment.