Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
play-unfair
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcela Ribeiro de Oliveira
play-unfair
Commits
2be06c8f
Commit
2be06c8f
authored
6 years ago
by
Marcela Ribeiro de Oliveira
Browse files
Options
Downloads
Patches
Plain Diff
lol
parent
015b867d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/playfair.h
+2
-0
2 additions, 0 deletions
include/playfair.h
playfair.cpp
+0
-12
0 additions, 12 deletions
playfair.cpp
playunfair.cpp
+10
-6
10 additions, 6 deletions
playunfair.cpp
with
12 additions
and
18 deletions
include/playfair.h
+
2
−
0
View file @
2be06c8f
...
...
@@ -2,6 +2,8 @@
#include
<string>
#include
<vector>
#include
<iterator>
#include
<sstream>
#include
<cctype>
std
::
vector
<
char
>
createKM
(
const
std
::
string
key
);
std
::
string
playfair
(
std
::
string
text
,
const
std
::
string
key
);
This diff is collapsed.
Click to expand it.
playfair.cpp
+
0
−
12
View file @
2be06c8f
...
...
@@ -36,7 +36,6 @@ std::string playfair(std::string text, const std::string key){
}
std
::
cout
<<
std
::
endl
;
}
int
indexT
=
-
1
;
char
fst
=
text
[
++
indexT
];
char
snd
=
text
[
++
indexT
];
...
...
@@ -47,17 +46,6 @@ std::string playfair(std::string text, const std::string key){
int
iFst
,
iSnd
;
for
(
int
i
=
0
;
i
<
25
;
++
i
){
if
(
mKey
[
i
]
==
fst
){
iFst
=
i
;
}
if
(
mKey
[
i
]
==
snd
){
iSnd
=
i
;
}
}
char
retfst
,
retsnd
;
retfst
=
mKey
[
iFst
/
5
+
iSnd
%
5
]
//TODO:change
return
text
;
}
This diff is collapsed.
Click to expand it.
playunfair.cpp
+
10
−
6
View file @
2be06c8f
#include
"include/playfair.h"
#include
<fstream>
#include
<vector>
#include
<string>
#include
<sstream>
#include
<algorithm>
void
parser
(
std
::
string
&
text
){
text
.
erase
(
std
::
remove
(
text
.
begin
(),
text
.
end
(),
' '
),
text
.
end
());
//for(const char &
}
int
main
(
int
argc
,
char
*
argv
[]){
if
(
argc
!=
3
){
...
...
@@ -25,8 +28,9 @@ int main(int argc, char *argv[]){
while
(
std
::
getline
(
input
,
aux
))
text
<<
aux
;
std
::
cout
<<
text
.
str
()
<<
std
::
endl
;
//chamar play fair passando string e chave
crip
=
playfair
(
text
.
str
(),
key
);
crip
=
text
.
str
();
parser
(
crip
);
std
::
cout
<<
crip
<<
std
::
endl
;
crip
=
playfair
(
crip
,
key
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment