diff --git a/db.sqlite3 b/db.sqlite3
new file mode 100644
index 0000000..337ba59
Binary files /dev/null and b/db.sqlite3 differ
diff --git a/enc_dec/__init__.py b/enc_dec/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/enc_dec/__pycache__/__init__.cpython-36.pyc b/enc_dec/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..4cd433c
Binary files /dev/null and b/enc_dec/__pycache__/__init__.cpython-36.pyc differ
diff --git a/enc_dec/__pycache__/admin.cpython-36.pyc b/enc_dec/__pycache__/admin.cpython-36.pyc
new file mode 100644
index 0000000..658198a
Binary files /dev/null and b/enc_dec/__pycache__/admin.cpython-36.pyc differ
diff --git a/enc_dec/__pycache__/models.cpython-36.pyc b/enc_dec/__pycache__/models.cpython-36.pyc
new file mode 100644
index 0000000..f5e2bef
Binary files /dev/null and b/enc_dec/__pycache__/models.cpython-36.pyc differ
diff --git a/enc_dec/__pycache__/urls.cpython-36.pyc b/enc_dec/__pycache__/urls.cpython-36.pyc
new file mode 100644
index 0000000..98de8c5
Binary files /dev/null and b/enc_dec/__pycache__/urls.cpython-36.pyc differ
diff --git a/enc_dec/__pycache__/views.cpython-36.pyc b/enc_dec/__pycache__/views.cpython-36.pyc
new file mode 100644
index 0000000..ee492e6
Binary files /dev/null and b/enc_dec/__pycache__/views.cpython-36.pyc differ
diff --git a/enc_dec/admin.py b/enc_dec/admin.py
new file mode 100644
index 0000000..437b66b
--- /dev/null
+++ b/enc_dec/admin.py
@@ -0,0 +1,6 @@
+from django.contrib import admin
+
+from .models import Method
+# Register your models here.
+
+admin.site.register(Method)
\ No newline at end of file
diff --git a/enc_dec/apps.py b/enc_dec/apps.py
new file mode 100644
index 0000000..86e32cc
--- /dev/null
+++ b/enc_dec/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class EncDecConfig(AppConfig):
+ name = 'enc_dec'
diff --git a/enc_dec/migrations/0001_initial.py b/enc_dec/migrations/0001_initial.py
new file mode 100644
index 0000000..fc46a0f
--- /dev/null
+++ b/enc_dec/migrations/0001_initial.py
@@ -0,0 +1,22 @@
+# Generated by Django 3.1 on 2020-08-11 11:38
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Method',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(blank=True, max_length=200, null=True)),
+ ('explanation', models.TextField(blank=True, null=True)),
+ ],
+ ),
+ ]
diff --git a/enc_dec/migrations/0002_method_image.py b/enc_dec/migrations/0002_method_image.py
new file mode 100644
index 0000000..afe8f33
--- /dev/null
+++ b/enc_dec/migrations/0002_method_image.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.1 on 2020-08-11 21:27
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('enc_dec', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='method',
+ name='image',
+ field=models.TextField(blank=True, null=True),
+ ),
+ ]
diff --git a/enc_dec/migrations/__init__.py b/enc_dec/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/enc_dec/migrations/__pycache__/0001_initial.cpython-36.pyc b/enc_dec/migrations/__pycache__/0001_initial.cpython-36.pyc
new file mode 100644
index 0000000..07b4985
Binary files /dev/null and b/enc_dec/migrations/__pycache__/0001_initial.cpython-36.pyc differ
diff --git a/enc_dec/migrations/__pycache__/0002_method_image.cpython-36.pyc b/enc_dec/migrations/__pycache__/0002_method_image.cpython-36.pyc
new file mode 100644
index 0000000..84e65db
Binary files /dev/null and b/enc_dec/migrations/__pycache__/0002_method_image.cpython-36.pyc differ
diff --git a/enc_dec/migrations/__pycache__/__init__.cpython-36.pyc b/enc_dec/migrations/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..24ef8ae
Binary files /dev/null and b/enc_dec/migrations/__pycache__/__init__.cpython-36.pyc differ
diff --git a/enc_dec/models.py b/enc_dec/models.py
new file mode 100644
index 0000000..d0d75ea
--- /dev/null
+++ b/enc_dec/models.py
@@ -0,0 +1,10 @@
+from django.db import models
+
+# Create your models here.
+class Method(models.Model):
+ name = models.CharField(max_length=200, blank=True, null=True)
+ explanation = models.TextField(blank=True, null=True)
+ image = models.TextField(blank=True, null=True)
+
+ def __str__(self):
+ return self.name
\ No newline at end of file
diff --git a/enc_dec/static/css/style.css b/enc_dec/static/css/style.css
new file mode 100644
index 0000000..f4a5186
--- /dev/null
+++ b/enc_dec/static/css/style.css
@@ -0,0 +1,43 @@
+body {
+ background-color: rgb(240, 240, 240) !important;
+}
+.main {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+}
+div {
+ margin: 1%;
+}
+h1 {
+ text-align: center;
+ padding-top: 1%;
+}
+.card-text {
+ min-height: 50px;
+}
+p {
+ text-align: justify;
+}
+#method_head {
+ text-align: center;
+ font-size: 3rem;
+ margin-bottom: 5%;
+ font-weight: bold;
+}
+#result {
+ color: red;
+ font-weight: bold;
+ text-align: center;
+ font-size: xx-large;
+ margin-top: 10%;
+}
+#translate {
+ position: absolute;
+ left: 47%;
+ margin: 2% 0%;
+}
+#home_button{
+ margin-right: 5%;
+ float: right;
+}
\ No newline at end of file
diff --git a/enc_dec/templates/enc_dec/homepage.html b/enc_dec/templates/enc_dec/homepage.html
new file mode 100644
index 0000000..cda15c4
--- /dev/null
+++ b/enc_dec/templates/enc_dec/homepage.html
@@ -0,0 +1,51 @@
+{% load static %}
+
+
+
+
+
+ Enc_Dec
+
+
+
+
+ Encryption / Decryption Program
+
+
+ {% for method in methods %}
+
+

+
+
{{ method.name }}
+
+ {{ method.explanation|linebreaksbr }}
+
+
Encrypt / Decrypt
+
+
+ {% endfor %}
+
+
+
+
+
+
diff --git a/enc_dec/templates/enc_dec/method.html b/enc_dec/templates/enc_dec/method.html
new file mode 100644
index 0000000..45575d8
--- /dev/null
+++ b/enc_dec/templates/enc_dec/method.html
@@ -0,0 +1,67 @@
+{% load static %}
+
+
+
+
+
+ Document
+
+
+
+
+
+
{{method.name}}
+
+
+
>> {{result}} <<
+
+ Go To Home
+
+
+
+
+
diff --git a/enc_dec/tests.py b/enc_dec/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/enc_dec/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/enc_dec/urls.py b/enc_dec/urls.py
new file mode 100644
index 0000000..1287020
--- /dev/null
+++ b/enc_dec/urls.py
@@ -0,0 +1,6 @@
+from django.urls import path
+from . import views
+
+urlpatterns = [
+ path('', views.homePage, name='homePage'),
+ path('method//', views.cipher, name='method'),]
\ No newline at end of file
diff --git a/enc_dec/views.py b/enc_dec/views.py
new file mode 100644
index 0000000..f3efcdc
--- /dev/null
+++ b/enc_dec/views.py
@@ -0,0 +1,179 @@
+from django.shortcuts import render
+import math
+import random
+from .models import Method
+# Create your views here.
+
+
+def homePage(request):
+ methods = Method.objects.all()
+ return render(request, 'enc_dec/homepage.html', {'methods': methods})
+
+
+def cipher(request, pk):
+ method = Method.objects.get(pk=pk)
+ message = request.GET.get("message")
+ encrypt = request.GET.get("crypt")
+ result = ""
+ if(method.name == "Caesar Cipher"):
+ shiftPattern = request.GET.get("shiftPattern")
+ if(message != None and shiftPattern != None):
+ if(encrypt == "true"):
+ result = Caesar.encryption(message, int(shiftPattern))
+ else:
+ result = Caesar.decryption(message, int(shiftPattern))
+ elif(method.name == "Vigenere Cipher"):
+ key = request.GET.get("key")
+ if(message != None and key != None):
+ if(len(key) <= len(message)):
+ if(encrypt == "true"):
+ result = Vigenere.encryption(message, key)
+ else:
+ result = Vigenere.decryption(message, key)
+ else:
+ result = "Error: len(vigenere_key)>len(message)"
+ elif(method.name == "Shifting"):
+ shiftPattern = request.GET.get("shiftPattern")
+ if(message != None and shiftPattern != None):
+ if(encrypt == "true"):
+ result = Shifting.encryption(message, int(shiftPattern))
+ else:
+ result = Shifting.decryption(message, int(shiftPattern))
+ elif(method.name == "Private Library"):
+ if(message != None):
+ if(encrypt == "true"):
+ result = Private.encryption(message)
+ else:
+ result = Private.decryption(message)
+ return render(request, 'enc_dec/method.html', {"method": method, "result": result})
+
+
+class Caesar():
+ def encryption(text, s):
+ result = ""
+ for i in range(len(text)):
+ char = text[i]
+ if (char.isupper()):
+ result += chr((ord(char) + s-65) % 26 + 65)
+ else:
+ result += chr((ord(char) + s - 97) % 26 + 97)
+ return result
+
+ def decryption(message, key):
+ key = -key
+ encrypted = ''
+ for symbol in message:
+ if symbol.isalpha():
+ num = ord(symbol)
+ num += key
+ if symbol.isupper():
+ if num > ord('Z'):
+ num -= 26
+ elif num < ord('A'):
+ num += 26
+ elif symbol.islower():
+ if num > ord('z'):
+ num -= 26
+ elif num < ord('a'):
+ num += 26
+ encrypted += chr(num)
+ else:
+ encrypted += symbol
+ return encrypted
+
+
+class Vigenere():
+
+ def new_alph(char):
+ char = char.lower()
+ alph = 'abcdefghijklmnopqrstuvwxyz'
+ new_alph = alph[alph.index(char):] + alph[:alph.index(char)]
+ return new_alph
+
+ def encryption(text, big_key):
+ res = ''
+ alph = 'abcdefghijklmnopqrstuvwxyz'
+ if len(big_key) <= len(text):
+ big_key = big_key * (len(text) // len(big_key)) + \
+ big_key[:len(text) % len(big_key)]
+ i = 1
+ for char in big_key:
+ new = Vigenere.new_alph(char)
+ for t in text:
+ if alph.count(t) == 1:
+ res += new[alph.index(t)]
+ text = text[i:]
+ break
+ elif alph.count(t.lower()) == 1:
+ res += new[alph.index(t.lower())].upper()
+ text = text[i:]
+ break
+ else:
+ res += t
+ text = text[i:]
+ break
+ i += 1
+ return res
+
+ def decryption(text, big_key):
+ res = ''
+ alph = 'abcdefghijklmnopqrstuvwxyz'
+ if len(big_key) <= len(text):
+ big_key = big_key * (len(text) // len(big_key)) + \
+ big_key[:len(text) % len(big_key)]
+ i = 1
+ for char in big_key:
+ new = Vigenere.new_alph(char)
+ for t in text:
+ if alph.count(t) == 1:
+ res += alph[new.index(t)]
+ text = text[i:]
+ break
+ elif alph.count(t.lower()) == 1:
+ res += alph[new.index(t.lower())].upper()
+ text = text[i:]
+ break
+ else:
+ res += t
+ text = text[i:]
+ break
+ i += 1
+ return res
+
+
+class Shifting():
+ def encryption(message, key):
+ leftFirst = message[0 : key]
+ leftSecond = message[key :]
+ return (leftSecond + leftFirst)
+
+ def decryption(message, key):
+ rightFirst = message[0: len(message)-key]
+ rightSecond = message[len(message)-key : ]
+ return (rightSecond + rightFirst)
+
+
+class Private():
+ encryption_letters = {'a': 'b', 'b': 'e', 'c': 'v', 'd': 'j', 'e': 'Q', 'f': 'w', 'g': 'T', 'h': 'l', 'i': 'O', 'j': 'y', 'k': 'A', 'l': 'W', 'm': 'N',
+ 'n': 'c', 'o': 'h', 'p': 'F', 'q': 'o', 'r': 'D', 's': 'M', 't': 'C', 'u': 'J', 'x': 'L', 'w': 'Y', 'v': 'I', 'y': 'x', 'z': 'E',
+ 'A': 'K', 'B': 'X', 'C': 'B', 'D': 'i', 'E': 'R', 'F': 'd', 'G': 'S', 'H': 'H', 'I': 'n', 'J': 'P', 'K': 'f', 'L': 'U', 'M': 's',
+ 'N': 'r', 'O': 'g', 'P': 't', 'Q': 'Z', 'R': 'G', 'S': 'm', 'T': 'z', 'U': 'q', 'X': 'V', 'W': 'p', 'V': 'u', 'Y': 'k', 'Z': 'a',
+ ' ': '.', '?': '!', '.': '?', '!': "'", "'": ' '}
+
+ decryption_letters = {'a': 'Z', 'b': 'a', 'e': 'b', 'v': 'c', 'j': 'd', 'Q': 'e', 'w': 'f', 'T': 'g', 'l': 'h', 'O': 'i', 'y': 'j', 'A': 'k',
+ 'W': 'l', 'N': 'm', 'c': 'n', 'h': 'o', 'F': 'p', 'o': 'q', 'D': 'r', 'M': 's', 'C': 't', 'J': 'u', 'L': 'x',
+ 'Y': 'w', 'I': 'v', 'x': 'y', 'E': 'z', 'K': 'A', 'X': 'B', 'B': 'C', 'i': 'D', 'R': 'E', 'd': 'F', 'S': 'G',
+ 'H': 'H', 'n': 'I', 'P': 'J', 'f': 'K', 'U': 'L', 's': 'M', 'r': 'N', 'g': 'O', 't': 'P', 'Z': 'Q', 'G': 'R',
+ 'm': 'S', 'z': 'T', 'q': 'U', 'V': 'X', 'p': 'W', 'u': 'V', 'k': 'Y', '.': ' ', '!': '?', '?': '.', "'": '!', ' ': "'"}
+
+ def encryption(message):
+ encrypted = ""
+ for i in message:
+ encrypted += Private.encryption_letters[i]
+ return encrypted
+
+ def decryption(message):
+ decrypted = ""
+ for i in message:
+ decrypted += Private.decryption_letters[i]
+ return decrypted
diff --git a/manage.py b/manage.py
new file mode 100644
index 0000000..25b6a21
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proje.settings')
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/proje/__init__.py b/proje/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/proje/__pycache__/__init__.cpython-36.pyc b/proje/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..13d5abb
Binary files /dev/null and b/proje/__pycache__/__init__.cpython-36.pyc differ
diff --git a/proje/__pycache__/settings.cpython-36.pyc b/proje/__pycache__/settings.cpython-36.pyc
new file mode 100644
index 0000000..1367298
Binary files /dev/null and b/proje/__pycache__/settings.cpython-36.pyc differ
diff --git a/proje/__pycache__/urls.cpython-36.pyc b/proje/__pycache__/urls.cpython-36.pyc
new file mode 100644
index 0000000..e25d754
Binary files /dev/null and b/proje/__pycache__/urls.cpython-36.pyc differ
diff --git a/proje/__pycache__/wsgi.cpython-36.pyc b/proje/__pycache__/wsgi.cpython-36.pyc
new file mode 100644
index 0000000..4319bff
Binary files /dev/null and b/proje/__pycache__/wsgi.cpython-36.pyc differ
diff --git a/proje/asgi.py b/proje/asgi.py
new file mode 100644
index 0000000..e082421
--- /dev/null
+++ b/proje/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for proje project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proje.settings')
+
+application = get_asgi_application()
diff --git a/proje/settings.py b/proje/settings.py
new file mode 100644
index 0000000..ff5acad
--- /dev/null
+++ b/proje/settings.py
@@ -0,0 +1,125 @@
+"""
+Django settings for proje project.
+
+Generated by 'django-admin startproject' using Django 3.1.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.1/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/3.1/ref/settings/
+"""
+import os.path
+from pathlib import Path
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'h#1!x*w6xvzeduu%2lt5j_4up@iyy0zatbl$f@5@*#8b9++g4z'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'enc_dec',
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'proje.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': ['templates'],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'proje.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/3.1/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/3.1/howto/static-files/
+
+STATIC_ROOT = ''
+
+STATIC_URL = '/static/'
+
+STATICFILES_DIRS = ( os.path.join('static'), )
\ No newline at end of file
diff --git a/proje/urls.py b/proje/urls.py
new file mode 100644
index 0000000..485bbcc
--- /dev/null
+++ b/proje/urls.py
@@ -0,0 +1,22 @@
+"""crypto URL Configuration
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/3.0/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path, include
+
+urlpatterns = [
+ path('admin/', admin.site.urls),
+ path('', include('enc_dec.urls'))
+]
\ No newline at end of file
diff --git a/proje/wsgi.py b/proje/wsgi.py
new file mode 100644
index 0000000..3f26ae3
--- /dev/null
+++ b/proje/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for proje project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proje.settings')
+
+application = get_wsgi_application()