Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
1,099 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6qCY8DyfL49b76LBmnXJnNjRuZAgQjupR90uxC-sM4I= |
Oops, something went wrong.