#NEWLINE# def _fast_hmac( key , msg , digest ) : #NEWLINE# #INDENT# "\n    A trimmed down version of Python's HMAC implementation\n    " #NEWLINE# ( dig1 , dig2 ) = ( digest ( ) , digest ( ) ) #NEWLINE# key = smart_str ( key ) #NEWLINE# if ( len ( key ) > dig1 . block_size ) : #NEWLINE# #INDENT# key = digest ( key ) . digest ( ) #NEWLINE# #UNINDENT# key += ( chr ( 0 ) * ( dig1 . block_size - len ( key ) ) ) #NEWLINE# dig1 . update ( key . translate ( _trans_36 ) ) #NEWLINE# dig1 . update ( msg ) #NEWLINE# dig2 . update ( key . translate ( _trans_5c ) ) #NEWLINE# dig2 . update ( dig1 . digest ( ) ) #NEWLINE# return dig2