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; } } }
查看全文
相关阅读:
3d角色模型 制作 全过程 。3d max 。3d role model making process.3d Max
Cocos2d-X开发教程-捕鱼达人 Cocos2-x development tutorial
unity3d 给游戏添加音源 Unity3d adds a sound source to the game
安卓 运行、调试 配置 android Run/debug configurations
Gradle 同步 已经开始 Gradle sync started
更新 是 可用的 针对 安卓 软件开发包和工具 Updates are available for android software development packages and tools
[Educational Codeforces Round 16]A. King Moves
他们在军训,我在搞 OI(一)
[POJ1383]Labyrinth
[POJ1157]LITTLE SHOP OF FLOWERS
原文地址:https://www.cnblogs.com/javawebsoa/p/2458108.html
最新文章
关于因子和与因子个数
zzuli1728(数学期望,组合数)
hpu积分赛(回溯法)
poj1664 放苹果(DPorDFS)&&系列突破(整数划分)
quick pow
zzuli 1726 迷宫 BFS(题意)
对编码内容多次UrlDecode
js中判断值不等于undefined
如何用vs查看框架函数管道模型
如何:调试 .NET Framework 源代码
热门文章
.net改善程序性能建议
方法表
应用程序域-学习
共享程序集GAC
什么是BCL
负载均衡-新文章
Scratch儿童项目式编程--接球游戏 Scratch children program programming
仙剑奇侠传 游戏 开发 教程 Xianjian qixia development Game development tutorial
像素鸟 游戏开发教程 FlappyBird Game development tutorial
3d模型 手办制作 3d model manual production
Copyright © 2011-2022 走看看