Skip to content

Commit

Permalink
Hashing Function completed
Browse files Browse the repository at this point in the history
  • Loading branch information
subhayuroy committed Sep 16, 2020
0 parents commit 7afd832
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/Computational Forensics.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Hashing Function/advance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import uuid, hashlib


def hash_password(password):
salt = uuid.uuid4().hex
return hashlib.sha256(salt.encode() + password.encode()).hexdigest() + ':' + salt


def check_password(hashed_psswd, user_psswd):
password, salt = hashed_psswd.split(':')
return password == hashlib.sha256(salt.encode() + user_psswd.encode()).hexdigest()


new_pass = input("Enter required password= ")
hashed_psswd = hash_password(new_pass)
print('The string to store in the db is: ' + hashed_psswd)
old_pass = input("Re-enter new password= ")

if check_password(hashed_psswd, old_pass):
print("You entered the correct password")
else:
print("The passwords don't match")
10 changes: 10 additions & 0 deletions Hashing Function/basic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import sys, string, md5hash

print("Enter your full name: ")
line = sys.stdin.readline()
line = line.rstrip()

md5_obj = md5hash.new()
md5_obj.update(line)

print(md5_obj.hexidigest())
Binary file added Hashing Function/hash_function_flowchart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7afd832

Please sign in to comment.