zoukankan
html css js c++ java
windows phone开发之客户端本地简单填充加密解密
using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using System.Security.Cryptography; //创建人:vakin 时间:2011-12-15 namespace MicroBlogForWP7.Classes.Util { //将输入的字符串转换为字节数组 //然后使用ProtectedData以及预先定义的字节数组进行加密 //加密后得到的也是一个字节数据 //最后使用Convert.ToBase64String得到其对应的字符串 public class Encrypt { //预先定义的字节数组如下: byte[] opt = new byte[] { 1, 2, 4, 8, 16 }; /// <summary> /// 密码的加密操作 /// </summary> /// <param name="userpassword">未加密的密码内容</param> /// <returns></returns> private string EncryptPwd(string userpassword) { byte[] input = System.Text.Encoding.UTF8.GetBytes(userpassword); string result = Convert.ToBase64String(ProtectedData.Protect(input, opt)); return result; } /// <summary> /// 解密解码。没有加密的情况下返回null /// </summary> /// <param name="userpassword">加密后的密码内容</param> /// <returns></returns> private string DecryptPwd(string userpassword) { if (string.IsNullOrEmpty(userpassword)) { //没有加密的密码 return null; } byte[] output = Convert.FromBase64String(userpassword); byte[] en = ProtectedData.Unprotect(output, opt); string result = System.Text.Encoding.UTF8.GetString(en, 0, en.Length); return result; } } }
查看全文
相关阅读:
Qt数据库集成应用封装
Qt个人研究进展
Qt仿win7自动顶部最大化左侧右侧半屏效果
Qt编写QUI皮肤生成器
java定时任务
进程间通信(java)--队列
单例设计模式-java
Java RMI
远程调用方式概述
IO模型-java版
原文地址:https://www.cnblogs.com/javawebsoa/p/2458108.html
最新文章
powerdesigner与mysql数据库的连接
div的定位
用window调用kjb和ktr
命令行启动kettle
在jsp页面比较时间的大小
php或js判断网站访问者来自手机或者pc机
Vs2008几个快捷键
雪狐商城
$(document).ready()使用讨论
财付通和支付宝资料收集
热门文章
thinkphp模板中使用自定义函数
thinkphp分配数组
在Zend Studio中为ThinkPHP添加代码自动提示功能
CSS
Qt编写的RTSP播放器+视频监控(ffmpeg版本)
QSS样式表之PS黑色风格+白色风格+淡蓝色风格(开源)
Qt+imx6编写的楼宇对讲管理平台
Qt编写视频监控画面分割界面(开源)
一家公司干了8年的程序员的年终总结
Qt编写导航按钮
Copyright © 2011-2022 走看看