I have a class with string data, and I'm supposed to calculate hash of the whole object using hashlib.sha256() .
I was not directly able to get hash with
block c for example
Hash = hashlib.sha256(c.encode()).digest()
I want to calculate hash of the whole object,I was suggested to have a function in the class such that it returns hash of data inside it . Is it same as has of whole block ? What is better implementation?