Finishing 11 new elements

This commit is contained in:
2020-01-08 17:32:09 +01:00
parent da0609f315
commit 1dcfd757e8
11 changed files with 411 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
import hashlib
def checkio(hashed_string, algorithm):
m = hashlib.new(algorithm)
m.update(hashed_string.encode('utf-8'))
return m.hexdigest()
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert checkio('welcome', 'md5') == '40be4e59b9a2a2b5dffb918c0e86b3d7'
assert checkio('happy spam', 'sha224') == '6e9dc3e01d57f1598c2b40ce59fc3527e698c77b15d0840ae96a8b5e'