UIButton*sideMenuButton=[UIButtonbuttonWithType:UIButtonTypeCustom];sideMenuButton.bounds=CGRectMake(0,0,20,20);[sideMenuButtonsetImage:[UIImageimageNamed:@"sidemenu_icon.png"]forState:UIControlStateNormal];[sideMenuButtonaddTarget:selfaction:@selector(toggleRightPanelAction)forControlEvents:UIControlEventTouchUpInside];self.navigationItem.rightBarButtonItem=[[UIBarButtonItemalloc]initWithCustomView:sideMenuButton];// =>// scoped temp variables. last line will be returned.self.navigationItem.rightBarButtonItem=({UIButton*sideMenuButton=[UIButtonbuttonWithType:UIButtonTypeCustom];sideMenuButton.bounds=CGRectMake(0,0,20,20);[sideMenuButtonsetImage:[UIImageimageNamed:@"sidemenu_icon.png"]forState:UIControlStateNormal];[sideMenuButtonaddTarget:selfaction:@selector(toggleRightPanelAction)forControlEvents:UIControlEventTouchUpInside];[[UIBarButtonItemalloc]initWithCustomView:sideMenuButton];});
user_info={"username":"...","password":"..."}user_str=json.dumps(user_info)cipher=Cipher("aes_128_cbc",key=PRIVATE_KEY,init_vector=INIT_VECTOR,op=ENCODE)encrypted_bytes=cipher.update(user_str)encrypted_bytes+=cipher.final()# flush out the current 128 bit blockurl="http://example.com/?user_info="+base64.urlsafe_b64encode(encrypted_bytes)…#=>defurl_safe_encrypt(obj):obj_str=json.dumps(obj)cipher=Cipher("aes_128_cbc",key=PRIVATE_KEY,init_vector=INIT_VECTOR,op=ENCODE)encrypted_bytes=cipher.update(obj_str)encrypted_bytes+=cipher.final()# flush out the current 128 bit blockreturnbase64.urlsafe_b64encode(encrypted_bytes)user_info={"username":"...","password":"..."}url="http://example.com/?user_info="+url_safe_encrypt(user_info)#=> this went too far…user_info={"username":"...","password":"..."}url="http://example.com/?user_info="+url_safe_encrypt_obj(user_info)defurl_safe_encrypt_obj(obj):obj_str=json.dumps(obj)returnurl_safe_encrypt_str(obj_str)defurl_safe_encrypt_str(data):encrypted_bytes=encrypt(data)returnbase64.urlsafe_b64encode(encrypted_bytes)defencrypt(data):cipher=make_cipher()encrypted_bytes=cipher.update(data)encrypted_bytes+=cipher.final()# flush out any remaining bytesreturnencrypted_bytesdefmake_cipher():returnCipher("aes_128_cbc",key=PRIVATE_KEY,init_vector=INIT_VECTOR,op=ENCODE)