call aesEncrypt

This commit is contained in:
antoine 2016-05-20 21:05:23 +02:00 committed by Antoine
parent ddfce547d7
commit 3528afe987
5 changed files with 37 additions and 68 deletions

View File

@ -4,7 +4,6 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/CMakeLists.txt" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/aes.cpp" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/aes.cpp" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/aes.hpp" isTestSource="false" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />

View File

@ -2,14 +2,14 @@
<project version="4"> <project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true"> <component name="CMakeRunConfigurationManager" shouldGenerate="true" assignedExecutableTargets="true" buildAllGenerated="true">
<generated> <generated>
<config projectName="TP6-7" targetName="dequeSTL" />
<config projectName="aes" targetName="crypto" /> <config projectName="aes" targetName="crypto" />
<config projectName="aes" targetName="aes" /> <config projectName="aes" targetName="crypto.ex" />
<config projectName="aes" targetName="clean-all" /> <config projectName="aes" targetName="clean-all" />
<config projectName="aes" targetName="main" /> <config projectName="aes" targetName="main" />
<config projectName="aes" targetName="crypto.ex" />
<config projectName="TP6-7" targetName="clean-all" /> <config projectName="TP6-7" targetName="clean-all" />
<config projectName="TP6-7" targetName="ArrayGenerique" /> <config projectName="TP6-7" targetName="ArrayGenerique" />
<config projectName="TP6-7" targetName="dequeSTL" /> <config projectName="aes" targetName="aes" />
</generated> </generated>
</component> </component>
<component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true"> <component name="CMakeSettings" AUTO_RELOAD="true" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
@ -19,8 +19,9 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3856e2dc-6394-46af-bb28-0bc107cd1b44" name="Default" comment=""> <list default="true" id="3856e2dc-6394-46af-bb28-0bc107cd1b44" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/bin/crypt.ex" afterPath="$PROJECT_DIR$/bin/crypt.ex" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/makefile" afterPath="$PROJECT_DIR$/makefile" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/aes.hpp" afterPath="$PROJECT_DIR$/aes.hpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/mainCrypt.cpp" afterPath="$PROJECT_DIR$/mainCrypt.cpp" />
</list> </list>
<ignored path="aes.iws" /> <ignored path="aes.iws" />
<ignored path=".idea/workspace.xml" /> <ignored path=".idea/workspace.xml" />
@ -40,45 +41,11 @@
<favorites_list name="aes" /> <favorites_list name="aes" />
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300" />
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="4" column="42" selection-start-line="4" selection-start-column="42" selection-end-line="4" selection-end-column="42" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="aes.cpp" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/aes.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.051369864">
<caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="aes.hpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/aes.hpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/aes.cpp" root0="SKIP_INSPECTION" />
</component>
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
@ -94,10 +61,9 @@
<detection-done>true</detection-done> <detection-done>true</detection-done>
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="10" /> <option name="y" value="18" />
<option name="y" value="22" /> <option name="width" value="1366" />
<option name="width" value="1346" /> <option name="height" value="731" />
<option name="height" value="703" />
</component> </component>
<component name="ProjectInspectionProfilesVisibleTreeState"> <component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default"> <entry key="Project Default">
@ -224,12 +190,12 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="10" y="22" width="1346" height="703" extended-state="0" /> <frame x="0" y="18" width="1366" height="731" extended-state="6" />
<editor active="false" /> <editor active="false" />
<layout> <layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1376488" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15932453" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3289689" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="CMake" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32866043" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
@ -271,7 +237,7 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/aes.cpp"> <entry file="file://$PROJECT_DIR$/aes.hpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
@ -279,6 +245,14 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="4" column="42" selection-start-line="4" selection-start-column="42" selection-end-line="4" selection-end-column="42" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/aes.hpp"> <entry file="file://$PROJECT_DIR$/aes.hpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
@ -302,26 +276,18 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="4" column="42" selection-start-line="4" selection-start-column="42" selection-end-line="4" selection-end-column="42" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/aes.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.051369864">
<caret line="4" column="0" selection-start-line="4" selection-start-column="0" selection-end-line="4" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/aes.hpp"> <entry file="file://$PROJECT_DIR$/aes.hpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="-5.19802">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="1" column="0" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.18564357">
<caret line="5" column="0" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>

View File

@ -130,7 +130,7 @@ int aes::readFile(unsigned char** file, const char* filename) {
fseek(fd, 0, SEEK_SET); fseek(fd, 0, SEEK_SET);
// Allocate space for the file // Allocate space for the file
*file = (unsigned char*)malloc(fileLength); *file = (unsigned char*)malloc(fileLength); // @FIXME : failed for bigest file // maybe with new
if(*file == NULL) { if(*file == NULL) {
fprintf(stderr, "Failed to allocate memory\n"); fprintf(stderr, "Failed to allocate memory\n");
exit(1); exit(1);

Binary file not shown.

View File

@ -12,8 +12,11 @@ int main(int argc, char* argv[]) {
// Read the file to encrypt // Read the file to encrypt
unsigned char* file; unsigned char* file;
//******************************************************************* while a rajouté pour les gros fichier
// readFile fait l'aloccation mémoire !!! pensé au free // readFile fait l'aloccation mémoire !!! pensé au free
size_t fileLength = O->readFile(&file); size_t fileLength = O->readFile(&file);
O->aesEncrypt();
printf("%d bytes to be encrypted\n", (int)fileLength); printf("%d bytes to be encrypted\n", (int)fileLength);
// Encrypt the file // Encrypt the file
@ -38,6 +41,7 @@ int main(int argc, char* argv[]) {
free(encryptedFile); free(encryptedFile);
free(file); free(file);
//******************************************************************
delete O; delete O;
return 0; return 0;