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
ed646bef
Commit
ed646bef
authored
6 years ago
by
Marcela Ribeiro de Oliveira
Browse files
Options
Downloads
Patches
Plain Diff
começando filtro
parent
ed2e0934
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dicionario/palavras_chave.txt
+0
-24917
0 additions, 24917 deletions
dicionario/palavras_chave.txt
include/playunfair.h
+6
-0
6 additions, 0 deletions
include/playunfair.h
playunfair.cpp
+39
-17
39 additions, 17 deletions
playunfair.cpp
with
45 additions
and
24934 deletions
dicionario/palavras_chave.txt
deleted
100644 → 0
+
0
−
24917
View file @
ed2e0934
This diff is collapsed.
Click to expand it.
include/playunfair.h
0 → 100644
+
6
−
0
View file @
ed646bef
#include
"playfair.h"
#define ACCEPTED 1
#define REJECTED 0
int
filter
(
std
::
string
text
,
const
std
::
string
key
);
void
parser
(
std
::
string
&
text
);
This diff is collapsed.
Click to expand it.
playunfair.cpp
+
39
−
17
View file @
ed646bef
#include
"include/playfair.h"
#include
"include/play
un
fair.h"
#include
<fstream>
void
parser
(
std
::
string
&
text
){
text
.
erase
(
std
::
remove
(
text
.
begin
(),
text
.
end
(),
' '
),
text
.
end
());
std
::
transform
(
text
.
begin
(),
text
.
end
(),
text
.
begin
(),
::
tolower
);
}
int
main
(
int
argc
,
char
*
argv
[]){
if
(
argc
!=
3
){
std
::
cout
<<
"Uso: ./playunfair <file-in> <file-out>"
<<
std
::
endl
;
if
(
argc
!=
4
){
std
::
cout
<<
"Uso: ./playunfair <file-in> <file-out>
<dicionarion>
"
<<
std
::
endl
;
return
0
;
}
std
::
fstream
input
,
output
;
char
*
inputName
,
*
outputName
;
std
::
string
aux
=
""
,
key
=
"cachorro"
,
crip
;
//a key vai vir do dicionario futuramente
std
::
ostringstream
text
;
std
::
fstream
input
,
output
,
dict
;
char
*
inputName
,
*
outputName
,
*
dictName
;
std
::
string
aux
=
""
,
key
,
crip
;
//a key vai vir do dicionario futuramente
std
::
ostringstream
text
,
keys
;
inputName
=
argv
[
1
];
outputName
=
argv
[
2
];
dictName
=
argv
[
3
];
input
.
open
(
inputName
,
std
::
ifstream
::
in
);
if
(
!
input
.
good
()){
...
...
@@ -32,10 +29,37 @@ int main(int argc, char *argv[]){
std
::
cout
<<
text
.
str
()[
2
]
<<
std
::
endl
;
crip
=
text
.
str
();
parser
(
crip
);
std
::
cout
<<
crip
<<
std
::
endl
;
crip
=
playfair
(
crip
,
key
,
CRYPT
);
std
::
cout
<<
crip
<<
std
::
endl
;
//std::cout << crip << std::endl;
dict
.
open
(
dictName
,
std
::
ifstream
::
in
);
if
(
!
dict
.
good
()){
std
::
cout
<<
"Nao foi possivel abrir o dicionario"
<<
std
::
endl
;
return
0
;
}
//TODO: if filter returns accepted print key and text in file
while
(
std
::
getline
(
dict
,
aux
)){
keys
<<
aux
;
key
=
keys
.
str
();
crip
=
playfair
(
crip
,
key
,
DECRYPT
);
std
::
cout
<<
crip
<<
std
::
endl
;
std
::
cout
<<
key
<<
std
::
endl
;
keys
.
str
(
""
);
keys
.
clear
();
filter
(
crip
,
key
);
//chamar filtro para cada key
}
//crip = playfair(crip, key, DECRYPT);
//std::cout << crip << std::endl;
return
0
;
}
void
parser
(
std
::
string
&
text
){
text
.
erase
(
std
::
remove
(
text
.
begin
(),
text
.
end
(),
' '
),
text
.
end
());
std
::
transform
(
text
.
begin
(),
text
.
end
(),
text
.
begin
(),
::
tolower
);
}
int
filter
(
std
::
string
text
,
const
std
::
string
key
){
//TODO: if ( 4 primeiras letras sem vogal ||
// 3 char -('o') iguais seguidos ||
// 5 consoantes ||
...
...
@@ -46,7 +70,5 @@ int main(int argc, char *argv[]){
// )
// { elimina texto: muda pra proxima chave}
crip
=
playfair
(
crip
,
key
,
DECRYPT
);
std
::
cout
<<
crip
<<
std
::
endl
;
return
0
;
return
ACCEPTED
;
}
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