Browse Source

prakt2

master
Janko Hartwig 5 years ago
parent
commit
b6127c8807
5 changed files with 35 additions and 0 deletions
  1. 6
    0
      .idea/vcs.xml
  2. 0
    0
      krypto/__init__.py
  3. 12
    0
      krypto/hashes.py
  4. 9
    0
      starthash.py
  5. 8
    0
      teste_meine_funktionen.py

+ 6
- 0
.idea/vcs.xml View File

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

+ 0
- 0
krypto/__init__.py View File


+ 12
- 0
krypto/hashes.py View File

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
- 0
starthash.py View File

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
- 0
teste_meine_funktionen.py View File

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…
Cancel
Save