def cms_hash_token(token_id, mode='md5'):
 if (token_id is None):
  return None
 if (is_asn1_token(token_id) or is_pkiz(token_id)):
  hasher = hashlib.new(mode)
  if isinstance(token_id, six.text_type):
   token_id = token_id.encode('utf-8')
  hasher.update(token_id)
  return hasher.hexdigest()
 else:
  return token_id

def cms_hash_token ( token_id , mode = 'md5' ) : if ( token_id is None ) : return None if ( is_asn1_token ( token_id ) or is_pkiz ( token_id ) ) : hasher = hashlib . new ( mode ) if isinstance ( token_id , six . text_type ) : token_id = token_id . encode ( 'utf-8' ) hasher . update ( token_id ) return hasher . hexdigest ( ) else : return token_id
hash pki tokens .