Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG-material-public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container 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
Walter, Wolfgang
PROG-material-public
Commits
3c10dc86
Commit
3c10dc86
authored
1 year ago
by
dali662d
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
37c62976
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sonderuebung/SoSe2024/SU01_2024_04_10/01_Passwortchecker.f95
+163
-0
163 additions, 0 deletions
Sonderuebung/SoSe2024/SU01_2024_04_10/01_Passwortchecker.f95
with
163 additions
and
0 deletions
Sonderuebung/SoSe2024/SU01_2024_04_10/01_Passwortchecker.f95
0 → 100644
+
163
−
0
View file @
3c10dc86
module
passcode_mod
implicit
none
private
public
::
keineLZ
,
langGenug
,
kreativ
,
sicherGenug
contains
function
keineLZ
(
pc
)
logical
::
keineLZ
character
(
len
=
20
),
intent
(
in
)
::
pc
integer
::
i
keineLZ
=
.true.
aussen
:
do
i
=
1
,
len_trim
(
pc
)
if
(
pc
(
i
:
i
)
==
" "
)
then
keineLZ
=
.false.
exit
end
if
end
do
aussen
end
function
keineLZ
function
sicherGenug
(
pc
)
logical
::
sicherGenug
character
(
len
=
20
),
intent
(
in
)
::
pc
logical
::
gross
=
.false.
,
klein
=
.false.
,
zahl
=
.false.
integer
::
i
do
i
=
1
,
len_trim
(
pc
)
select
case
(
ichar
(
pc
(
i
:
i
)))
case
(
ichar
(
"0"
)
:
ichar
(
"9"
))
zahl
=
.true.
case
(
ichar
(
"A"
)
:
ichar
(
"Z"
))
gross
=
.true.
case
(
ichar
(
"a"
)
:
ichar
(
"z"
))
klein
=
.true.
case
default
end
select
if
(
zahl
.and.
gross
.and.
klein
)
exit
! nicht dringend notwendig
end
do
sicherGenug
=
zahl
.and.
gross
.and.
klein
end
function
sicherGenug
! alternative Funktion -> IF Schleife und ASCII anders
FUNCTION
sicherGenug_alt
(
pw
)
CHARACTER
(
*
),
INTENT
(
IN
)::
pw
LOGICAL
::
sicherGenug_alt
INTEGER
::
i
,
ascii
LOGICAL
::
gross
,
klein
,
ziffer
gross
=
.false.
klein
=
.false.
ziffer
=
.false.
DO
i
=
1
,
LEN
(
pw
)
ascii
=
IACHAR
(
pw
(
i
:
i
))
IF
(
ascii
>=
65
.AND.
ascii
<=
90
)
THEN
gross
=
.true.
ELSE
IF
(
ascii
>=
97
.AND.
ascii
<=
122
)
THEN
klein
=
.true.
ELSE
IF
(
ascii
>=
48
.AND.
ascii
<=
57
)
THEN
ziffer
=
.true.
END
IF
END
DO
sicherGenug_alt
=
ziffer
.AND.
klein
.AND.
gross
END
FUNCTION
sicherGenug_alt
function
langGenug
(
pc
)
logical
::
langGenug
character
(
len
=
20
),
intent
(
in
)
::
pc
if
(
len
(
trim
(
pc
))
>=
8
)
then
langGenug
=
.true.
else
langGenug
=
.false.
end
if
end
function
langGenug
function
kreativ
(
pc
)
implicit
none
logical
::
kreativ
character
(
len
=
20
),
intent
(
in
)
::
pc
character
(
len
=
20
)
::
help
integer
::
ios
kreativ
=
.true.
open
(
unit
=
30
,
iostat
=
ios
,
file
=
"bekanntepasswoerter.txt"
,
status
=
"old"
,
action
=
"read"
)
if
(
ios
==
0
)
then
do
read
(
30
,
*
,
iostat
=
ios
)
help
if
(
ios
/
=
0
)
exit
if
(
pc
==
help
)
then
kreativ
=
.false.
exit
end
if
end
do
else
write
(
*
,
*
)
"Datei konnte nicht korrekt geoeffnet werden!"
end
if
close
(
30
)
end
function
kreativ
end
module
passcode_mod
program
passcodecheck
use
passcode_mod
implicit
none
character
(
len
=
20
)
::
pc
,
pc2
logical
::
ok
=
.true.
do
do
write
(
*
,
*
)
"Gebe dein Passwort in Anfuehrungszeichen ein."
read
(
*
,
*
)
pc
write
(
*
,
*
)
"Wiederhole das Passwort"
read
(
*
,
*
)
pc2
if
(
pc
==
pc2
)
exit
write
(
*
,
*
)
"Die eingegebenen Passwoerter sind nicht gleich."
end
do
if
(
.not.
keineLZ
(
pc
))
then
write
(
*
,
*
)
"Es sind Leerzeichen in der Mitte."
ok
=
.false.
end
if
if
(
.not.
langGenug
(
pc
))
then
write
(
*
,
*
)
"Das Passwort ist nicht lang genug."
ok
=
.false.
end
if
if
(
.not.
sicherGenug
(
pc
))
then
write
(
*
,
*
)
"Es fehlen Gross-, Kleinbuchstaben oder Zahlen."
ok
=
.false.
end
if
if
(
.not.
kreativ
(
pc
))
then
write
(
*
,
*
)
"Das Passwort ist nicht sonderlich kreativ."
ok
=
.false.
end
if
if
(
ok
)
then
write
(
*
,
*
)
"Dein Passwort ist ok."
exit
end
if
end
do
end
program
passcodecheck
\ No newline at end of file
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