Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
-#!/usr/bin/python
+#!/usr/bin/python3
-import hashlib
-import os
import random
import re
import string
import unicodedata
-from .constants import *
-
# A list of possible random characters.
random_chars = string.ascii_letters + string.digits
ret.append("%s s" % t)
return " ".join(ret)
-
-def calc_hash(filename, algo="sha512"):
- assert algo in hashlib.algorithms
-
- f = open(filename, "rb")
- h = hashlib.new(algo)
-
- while True:
- buf = f.read(BUFFER_SIZE)
- if not buf:
- break
-
- h.update(buf)
-
- f.close()
-
- return h.hexdigest()