Fixed warning

This commit is contained in:
Leonetienne 2021-12-06 02:57:20 +01:00
parent 706f5fe4bc
commit 719bd5b7db
6 changed files with 15 additions and 56 deletions

View File

@ -111,12 +111,16 @@ GhettoCipher::Flexblock GhettoCipher::Cipher::Decipher(const Flexblock& data, bo
return ss.str(); return ss.str();
} }
#if defined _WIN32 || defined _WIN64
#pragma optimize("", off ) #pragma optimize("", off )
#endif
void GhettoCipher::Cipher::ZeroKeyMemory() void GhettoCipher::Cipher::ZeroKeyMemory()
{ {
key.reset(); key.reset();
return; return;
} }
#if defined _WIN32 || defined _WIN64
#pragma optimize("", on ) #pragma optimize("", on )
#endif
const GhettoCipher::Block GhettoCipher::Cipher::emptyBlock; const GhettoCipher::Block GhettoCipher::Cipher::emptyBlock;

View File

@ -192,7 +192,9 @@ void GhettoCipher::Feistel::GenerateRoundKeys(const Block& seedKey)
} }
// These pragmas only work for MSVC, as far as i know. Beware!!! // These pragmas only work for MSVC, as far as i know. Beware!!!
#if defined _WIN32 || defined _WIN64
#pragma optimize("", off ) #pragma optimize("", off )
#endif
void GhettoCipher::Feistel::ZeroKeyMemory() void GhettoCipher::Feistel::ZeroKeyMemory()
{ {
for (Block& key : roundKeys) for (Block& key : roundKeys)
@ -200,4 +202,6 @@ void GhettoCipher::Feistel::ZeroKeyMemory()
return; return;
} }
#if defined _WIN32 || defined _WIN64
#pragma optimize("", on ) #pragma optimize("", on )
#endif

View File

@ -24,29 +24,30 @@
<ProjectGuid>{2b2cf665-f5e6-44db-961f-fc81c88a356d}</ProjectGuid> <ProjectGuid>{2b2cf665-f5e6-44db-961f-fc81c88a356d}</ProjectGuid>
<RootNamespace>Feistel</RootNamespace> <RootNamespace>Feistel</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>GhettoCrypt</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
@ -114,7 +115,7 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
@ -128,7 +129,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
</ClCompile> </ClCompile>
<Link> <Link>
@ -142,7 +143,6 @@
<ClCompile Include="Feistel.cpp" /> <ClCompile Include="Feistel.cpp" />
<ClCompile Include="GhettoCipherWrapper.cpp" /> <ClCompile Include="GhettoCipherWrapper.cpp" />
<ClCompile Include="Cipher.cpp" /> <ClCompile Include="Cipher.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Block.h" /> <ClInclude Include="Block.h" />

View File

@ -18,9 +18,6 @@
<ClCompile Include="Feistel.cpp"> <ClCompile Include="Feistel.cpp">
<Filter>Quelldateien</Filter> <Filter>Quelldateien</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="main.cpp">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="GhettoCipherWrapper.cpp"> <ClCompile Include="GhettoCipherWrapper.cpp">
<Filter>Quelldateien</Filter> <Filter>Quelldateien</Filter>
</ClCompile> </ClCompile>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@ -1,46 +0,0 @@
#pragma once
#include <iostream>
#include "Util.h"
#include "GhettoCipherWrapper.h"
using namespace GhettoCipher;
void ExampleString()
{
std::cout << "Example on how to encrypt & decrypt a string:" << std::endl;
// Get some string
const std::string input = "I am a super secret message!";
std::cout << input << std::endl;
// Encrypt
const std::string encrypted = GhettoCryptWrapper::EncryptString(input, "password1");
std::cout << encrypted << std::endl;
// Decrypt
const std::string decrypted = GhettoCryptWrapper::DecryptString(encrypted, "password1");
std::cout << decrypted << std::endl;
return;
}
void ExampleFiles()
{
std::cout << "Example on how to encrypt & decrypt any file:" << std::endl;
// Encrypt
GhettoCryptWrapper::EncryptFile("main.cpp", "main.cpp.crypt", "password1");
// Decrypt
GhettoCryptWrapper::DecryptFile("main.cpp.crypt", "main.cpp.clear", "password1");
return;
}
int main()
{
ExampleString();
ExampleFiles();
return 0;
}