prakt2
This commit is contained in:
parent
e77996535f
commit
b6127c8807
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
0
krypto/__init__.py
Normal file
0
krypto/__init__.py
Normal file
12
krypto/hashes.py
Normal file
12
krypto/hashes.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
def hashMod(bytes):
|
||||||
|
result = 0
|
||||||
|
for byte in bytes:
|
||||||
|
result += byte
|
||||||
|
return result % sys.maxsize
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
test_hashmod = hashMod("test".encode('utf-8'))
|
||||||
|
print("Teste function hashMod : ", test_hashmod)
|
9
starthash.py
Normal file
9
starthash.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import krypto.hashes
|
||||||
|
|
||||||
|
aufruf_string = 'Hello'
|
||||||
|
aufruf_string = aufruf_string.encode('utf-8')
|
||||||
|
|
||||||
|
print(aufruf_string)
|
||||||
|
aufruf_string = krypto.hashes.hashMod(aufruf_string)
|
||||||
|
|
||||||
|
print(aufruf_string)
|
8
teste_meine_funktionen.py
Normal file
8
teste_meine_funktionen.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import krypto.hashes
|
||||||
|
import unittest
|
||||||
|
class TestHash(unittest.TestCase):
|
||||||
|
|
||||||
|
def teste_hashMod(self):
|
||||||
|
first_param = krypto.hashes.hashMod('Hi'.encode('utf-8'))
|
||||||
|
second_param = krypto.hashes.hashMod('Hi'.encode('utf-8'))
|
||||||
|
self.assertEquals(first_param, second_param, 'fehler ungleich')
|
Loading…
x
Reference in New Issue
Block a user