summaryrefslogtreecommitdiff
path: root/password_tutorial.c
diff options
context:
space:
mode:
authorClay Smith <claysmith158@gmail.com>2023-08-01 01:09:09 -0500
committerClay Smith <claysmith158@gmail.com>2023-08-01 01:09:09 -0500
commit102341d7ae8793c29d44fa416d3b5b797d1eca3e (patch)
tree6df9a5d5ef978dc6809a7d71d50de6e359dae2e7 /password_tutorial.c
First commitHEADmain
Diffstat (limited to 'password_tutorial.c')
-rw-r--r--password_tutorial.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/password_tutorial.c b/password_tutorial.c
new file mode 100644
index 0000000..901d69e
--- /dev/null
+++ b/password_tutorial.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int check_authentication(char *password) {
+ int auth_flag = 0;
+ char password_buffer[16];
+ int auth_flag2 = 0;
+ strcpy(password_buffer, password);
+
+ if(strcmp(password_buffer, "brillig") == 0)
+ auth_flag = 1;
+ if(strcmp(password_buffer, "outgrabe") == 0)
+ auth_flag = 1;
+
+ return auth_flag | auth_flag2;
+}
+
+int main(int argc, char *argv[]) {
+ if(argc < 2) {
+ printf("Usage: %s <password>\n", argv[0]);
+ exit(0);
+ }
+ if(check_authentication(argv[1])) {
+ printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
+ printf(" Access Granted.\n");
+ printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
+ } else {
+ printf("\nAccess Denied.\n");
+ }
+}