def __init__(self, data=None, truncate_to=None): """ SHA-265d against length-extensions-attacks with optional truncation of the hash Args: data: Initial string, optional truncate_to: length to truncate the hash to, optional """ self.h = sha256() self.truncate_to = truncate_to if data: self.h.update(data)