23 lines
433 B
Python
23 lines
433 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
data = []
|
|
|
|
# parse input
|
|
input_file = open("input-ex1", "r")
|
|
pattern = []
|
|
for line in input_file:
|
|
for value in line.rstrip().split(","):
|
|
data.append(value)
|
|
input_file.close()
|
|
|
|
hashsum = 0
|
|
for value in data:
|
|
hash = 0
|
|
for b in value:
|
|
hash += ord(b)
|
|
hash *= 17
|
|
hash %= 256
|
|
print(value, hash)
|
|
hashsum += hash
|
|
print("Hashsumme:", hashsum)
|