#NEWLINE# def mac( self , s , x , secret ) : #NEWLINE# #INDENT# '\n        obfs2 regular MAC: MAC(s, x) = H(s | x | s)\n\n        Optionally, if the client and server share a secret value SECRET,\n        they can replace the MAC function with:\n        MAC(s,x) = H^n(s | x | H(SECRET) | s)\n\n        where n = HASH_ITERATIONS.\n        ' #NEWLINE# if secret : #NEWLINE# #INDENT# secret_hash = h ( secret ) #NEWLINE# return hn ( ( ( ( s + x ) + secret_hash ) + s ) , self . ss_hash_iterations ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return h ( ( ( s + x ) + s ) )