diff --git a/red_fam.py b/red_fam.py new file mode 100644 index 0000000..c0b4848 --- /dev/null +++ b/red_fam.py @@ -0,0 +1,36 @@ + +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() +