Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SHA1BruteForce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Clément Février
SHA1BruteForce
Commits
57bad1ec
Commit
57bad1ec
authored
Nov 06, 2017
by
Clément Février
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makefile -std=gnu++11, constexpr, remove cstdio
parent
620d2dbe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
16 deletions
+17
-16
Makefile
Makefile
+4
-4
functions.cpp
functions.cpp
+5
-4
main.cpp
main.cpp
+8
-8
No files found.
Makefile
View file @
57bad1ec
...
...
@@ -30,22 +30,22 @@ all:ex
# Other flags are added.
# -pipe decreases compilation time.
#
CC
=
g++
-Ofast
-Wall
-Wextra
-pipe
-fassociative-math
-freciprocal-math
-fno-signed-zeros
-fno-trapping-math
-frename-registers
-funroll-loops
-fopenmp
-D_GLIBCXX_PARALLEL
CC
=
g++
-
std
=
gnu++11
-
Ofast
-Wall
-Wextra
-pipe
-fassociative-math
-freciprocal-math
-fno-signed-zeros
-fno-trapping-math
-frename-registers
-funroll-loops
-fopenmp
-D_GLIBCXX_PARALLEL
#
# Same as above with flags specific for AMD Piledriver Family 15h.
#
#CC= g++ -Ofast -Wall -Wextra -pipe -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math -frename-registers -funroll-loops -fopenmp -D_GLIBCXX_PARALLEL -march=bdver2 -msse -msse2 -msse3 -mmmx -m3dnow
#CC= g++ -
std=gnu++11 -
Ofast -Wall -Wextra -pipe -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math -frename-registers -funroll-loops -fopenmp -D_GLIBCXX_PARALLEL -march=bdver2 -msse -msse2 -msse3 -mmmx -m3dnow
#
# Use -fprofile-generate to generate a profile.
# Here for AMD Piledriver Family 15h.
#
#CC= g++ -Ofast -Wall -Wextra -pipe -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math -frename-registers -funroll-loops -fopenmp -D_GLIBCXX_PARALLEL -march=bdver2 -msse -msse2 -msse3 -mmmx -m3dnow -fprofile-generate
#CC= g++ -
std=gnu++11 -
Ofast -Wall -Wextra -pipe -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math -frename-registers -funroll-loops -fopenmp -D_GLIBCXX_PARALLEL -march=bdver2 -msse -msse2 -msse3 -mmmx -m3dnow -fprofile-generate
#
# Use -fprofile-use -fprofile-correction to use the profile.
# The second flag is needed for multithreading.
# Here for AMD Piledriver Family 15h.
#
#CC= g++ -Ofast -Wall -Wextra -pipe -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math -frename-registers -funroll-loops -fopenmp -D_GLIBCXX_PARALLEL -march=bdver2 -msse -msse2 -msse3 -mmmx -m3dnow -fprofile-use -fprofile-correction
#CC= g++ -
std=gnu++11 -
Ofast -Wall -Wextra -pipe -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math -frename-registers -funroll-loops -fopenmp -D_GLIBCXX_PARALLEL -march=bdver2 -msse -msse2 -msse3 -mmmx -m3dnow -fprofile-use -fprofile-correction
link
=
-o
...
...
functions.cpp
View file @
57bad1ec
...
...
@@ -28,9 +28,9 @@
//#include <crypto++/hex.h>
#include <string> // std::string
#include <iostream> // std::cout, ostream (std::endl)
#include <iostream> // std::cout, ostream (std::endl),
// io (std::hex)
#include <cstddef> // size_t
#include <cstdio> // std::printf
#include <cstdlib> // EXIT_SUCCESS, exit
#include <boost/thread.hpp> // boost::thread_group, boost::bind
...
...
@@ -136,9 +136,10 @@ void findPasswordThread(const unsigned char * hash, const std::string & pass, co
{
// Display once again the hash.
std
::
cout
<<
"* Hash SHA1:"
<<
std
::
endl
;
for
(
unsigned
char
x
=
0
;
x
<
20
;
++
x
)
for
(
unsigned
char
x
=
0
;
x
<
20
;
++
x
)
{
std
::
printf
(
"%x "
,
hash
[
x
]);
//Hex-format
// Hex-format
std
::
cout
<<
std
::
hex
<<
(
unsigned
short
int
)
hash
[
x
]
<<
" "
;
}
std
::
cout
<<
std
::
endl
;
// Display the password.
...
...
main.cpp
View file @
57bad1ec
...
...
@@ -28,8 +28,7 @@
#include <sstream> // std::istringstream
#include <vector> // std::vector
#include <iostream> // std::cout, ios (std::hex),
// ostream (std::endl)
#include <cstdio> // std::printf
// ostream (std::endl), io (std::hex)
#include "functions.h" // findPassword
...
...
@@ -69,18 +68,18 @@
int
main
()
{
// Number of threads to launch.
const
unsigned
char
N_THREAD
=
64
;
const
expr
unsigned
char
N_THREAD
=
64
;
// Max length of password.
const
unsigned
char
MaxLength
=
4
;
const
expr
unsigned
char
MaxLength
=
5
;
// SHA-1 hash to crack.
// Below few examples and their corresponding password.
// ZZZ
//std::string HASH = "11 6f f2 22 a3 b4 9b 63 34 8d 77 82 e4 b4 3f fe 2d cb b1 98";
std
::
string
HASH
=
"116ff222a3b49b63348d7782e4b43ffe2dcbb198"
;
//
std::string HASH = "116ff222a3b49b63348d7782e4b43ffe2dcbb198";
// ZZZZ
//std::string HASH = "98 65 d4 83 bc 5a 94 f2 e3 0 56 fc 25 6e d3 6 6a f5 4d 4";
// ZZZZZ
//
std::string HASH = "f8 88 fa 8a 61 ba 9a 53 a4 5f 4 a 4b bb 8b 2f c1 f6 44 44";
std
::
string
HASH
=
"f8 88 fa 8a 61 ba 9a 53 a4 5f 4 a 4b bb 8b 2f c1 f6 44 44"
;
// ZZZZZZ
//std::string HASH = "18 f3 f 1b a4 c6 2e 2b 46 e 69 33 6 b3 9a d e2 7d 74 7c";
//std::string HASH = "18 f3 f 1b a4 c6 2e 2b 46 e 69 33 6 b3 9a d e2 7d 74 7c";
...
...
@@ -131,9 +130,10 @@ int main ()
}
// Display the input SHA-1 hash.
std
::
cout
<<
"* Hash SHA1:"
<<
std
::
endl
;
for
(
int
x
=
0
;
x
<
20
;
++
x
)
for
(
unsigned
char
x
=
0
;
x
<
20
;
++
x
)
{
std
::
printf
(
"%x "
,
hash
[
x
]);
//Hex-format
// Hex-format
std
::
cout
<<
std
::
hex
<<
(
unsigned
short
int
)
hash
[
x
]
<<
" "
;
}
std
::
cout
<<
std
::
endl
;
// list: Create the list of all characters to test.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment