37 lines
788 B
Python
37 lines
788 B
Python
|
|
import hashlib
|
|
|
|
class RED_FAM:
|
|
|
|
def __init__( self, articlesList ):
|
|
"""
|
|
Generates a new RED_FAM object
|
|
|
|
@param articlesList list List of articles of redundance family
|
|
"""
|
|
|
|
self.__articlesList = articlesList
|
|
|
|
# Make sure we have 8 entrys for pages, if not fill with empty list items
|
|
while len( self.__articlesList ) < 8:
|
|
self.__articlesList.append( "" )
|
|
|
|
self.__hash = self.__get_fam_hash( )
|
|
|
|
print( self.__hash )
|
|
|
|
|
|
def __get_fam_hash( self ):
|
|
"""
|
|
Calculates the SHA-1 hash for the articlesList of redundance family.
|
|
Since we don't need security SHA-1 is just fine.
|
|
|
|
@returns str String with the hexadecimal hash digest
|
|
"""
|
|
|
|
h = hashlib.sha1()
|
|
h.update( str( self.__articlesList ).encode('utf-8') )
|
|
|
|
return h.hexdigest()
|
|
|