当前位置: 首页 > news >正文

wordpress安装错误前端seo是什么意思

wordpress安装错误,前端seo是什么意思,网站建设优化推广,wordpress加密访问接下来我们介绍对称加密算法,最常用的莫过于DES数据加密算法。 DES DES-Data Encryption Standard,即数据加密算法。是IBM公司于1975年研究成功并公开发表的。DES算法的入口参数有三个:Key、Data、Mode。其中Key为8个字节共64位,是DES算法的工作密钥;Data也为8个字节…

接下来我们介绍对称加密算法,最常用的莫过于DES数据加密算法。 
DES 
DES-Data Encryption Standard,即数据加密算法。是IBM公司于1975年研究成功并公开发表的。DES算法的入口参数有三个:Key、Data、Mode。其中Key为8个字节共64位,是DES算法的工作密钥;Data也为8个字节64位,是要被加密或被解密的数据;Mode为DES的工作方式,有两种:加密或解密。 
  DES算法把64位的明文输入块变为64位的密文输出块,它所使用的密钥也是64位。 

 

通过java代码实现如下:Coder类见 Java加密算法(一)

import java.security.Key;
import java.security.SecureRandom;import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;/*** DES安全编码组件* * <pre>* 支持 DES、DESede(TripleDES,就是3DES)、AES、Blowfish、RC2、RC4(ARCFOUR)* DES          		key size must be equal to 56* DESede(TripleDES) 	key size must be equal to 112 or 168* AES          		key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available* Blowfish     		key size must be multiple of 8, and can only range from 32 to 448 (inclusive)* RC2          		key size must be between 40 and 1024 bits* RC4(ARCFOUR) 		key size must be between 40 and 1024 bits* 具体内容 需要关注 JDK Document http://.../docs/technotes/guides/security/SunProviders.html* </pre>* */
public abstract class DESCoder extends Coder {/*** ALGORITHM 算法 <br>* 可替换为以下任意一种算法,同时key值的size相应改变。* * <pre>* DES          		key size must be equal to 56* DESede(TripleDES) 	key size must be equal to 112 or 168* AES          		key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available* Blowfish     		key size must be multiple of 8, and can only range from 32 to 448 (inclusive)* RC2          		key size must be between 40 and 1024 bits* RC4(ARCFOUR) 		key size must be between 40 and 1024 bits* </pre>* * 在Key toKey(byte[] key)方法中使用下述代码* <code>SecretKey secretKey = new SecretKeySpec(key, ALGORITHM);</code> 替换* <code>* DESKeySpec dks = new DESKeySpec(key);* SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);* SecretKey secretKey = keyFactory.generateSecret(dks);* </code>*/public static final String ALGORITHM = "DES";/*** 转换密钥<br>* * @param key* @return* @throws Exception*/private static Key toKey(byte[] key) throws Exception {DESKeySpec dks = new DESKeySpec(key);SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);SecretKey secretKey = keyFactory.generateSecret(dks);// 当使用其他对称加密算法时,如AES、Blowfish等算法时,用下述代码替换上述三行代码// SecretKey secretKey = new SecretKeySpec(key, ALGORITHM);return secretKey;}/*** 解密* * @param data* @param key* @return* @throws Exception*/public static byte[] decrypt(byte[] data, String key) throws Exception {Key k = toKey(decryptBASE64(key));Cipher cipher = Cipher.getInstance(ALGORITHM);cipher.init(Cipher.DECRYPT_MODE, k);return cipher.doFinal(data);}/*** 加密* * @param data* @param key* @return* @throws Exception*/public static byte[] encrypt(byte[] data, String key) throws Exception {Key k = toKey(decryptBASE64(key));Cipher cipher = Cipher.getInstance(ALGORITHM);cipher.init(Cipher.ENCRYPT_MODE, k);return cipher.doFinal(data);}/*** 生成密钥* * @return* @throws Exception*/public static String initKey() throws Exception {return initKey(null);}/*** 生成密钥* * @param seed* @return* @throws Exception*/public static String initKey(String seed) throws Exception {SecureRandom secureRandom = null;if (seed != null) {secureRandom = new SecureRandom(decryptBASE64(seed));} else {secureRandom = new SecureRandom();}KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM);kg.init(secureRandom);SecretKey secretKey = kg.generateKey();return encryptBASE64(secretKey.getEncoded());}
}

  延续上一个类的实现,我们通过MD5以及SHA对字符串加密生成密钥,这是比较常见的密钥生成方式。 
再给出一个测试类:

import static org.junit.Assert.*;import org.junit.Test;/*** 
*DES测试* */ public class DESCoderTest {@Testpublic void test() throws Exception {String inputStr = "DES";String key = DESCoder.initKey();System.err.println("原文:\t" + inputStr);System.err.println("密钥:\t" + key);byte[] inputData = inputStr.getBytes();inputData = DESCoder.encrypt(inputData, key);System.err.println("加密后:\t" + DESCoder.encryptBASE64(inputData));byte[] outputData = DESCoder.decrypt(inputData, key);String outputStr = new String(outputData);System.err.println("解密后:\t" + outputStr);assertEquals(inputStr, outputStr);} }

  得到的输出内容如下:

原文:	DES
密钥:	f3wEtRrV6q0=加密后:	C6qe9oNIzRY=解密后:	DES

  由控制台得到的输出,我们能够比对加密、解密后结果一致。这是一种简单的加密解密方式,只有一个密钥。 
    其实DES有很多同胞兄弟,如DESede(TripleDES)、AES、Blowfish、RC2、RC4(ARCFOUR)。这里就不过多阐述了,大同小异,只要换掉ALGORITHM换成对应的值,同时做一个代码替换SecretKey secretKey = new SecretKeySpec(key, ALGORITHM);就可以了,此外就是密钥长度不同了。

/*** DES          key size must be equal to 56* DESede(TripleDES) key size must be equal to 112 or 168* AES          key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available* Blowfish     key size must be multiple of 8, and can only range from 32 to 448 (inclusive)* RC2          key size must be between 40 and 1024 bits* RC4(ARCFOUR) key size must be between 40 and 1024 bits**/

  来源于:http://snowolf.iteye.com/blog

转载于:https://www.cnblogs.com/zengsong-restService/archive/2013/03/25/2980951.html

http://www.lbrq.cn/news/2607499.html

相关文章:

  • bs网站开发微信推广平台自己可以做
  • 怎么用云主机做网站网站关键词提升
  • 政府网站建设文案网站模板哪家好
  • 软件开发和网站开发网站制作培训
  • 学校营销型网站建设济宁百度推广公司有几家
  • 如何下载别人wordpress定制的主题hyein seo官网
  • 城阳建网站网页制作教程步骤
  • 口碑好的番禺网站建设谷歌关键词
  • 安徽省港航建设投资集团网站专业seo推广
  • 企信网全国windows优化大师卸载
  • 做网站系统的答辩ppt范文企业关键词推广
  • 非政府组织网站的建设google search
  • 河南新乡做网站公司哪家好宣传软文案例
  • b2b的网站有哪些(10个)谷歌排名算法
  • wordpress本地seo关键词分析
  • 个人音乐网站模板百度竞价冷门产品
  • vrchat视频转码青山seo排名公司
  • 重庆seo报价需要优化的网站有哪些
  • 做网站什么笔记本好用佛山网站建设方案咨询
  • 做mod游戏下载网站seo站长工具综合查询
  • 淮安谁家做网站上海网站排名seo公司哪家好
  • 高端旅游的网站建设网络服务器
  • 推荐门户网站建设公司赚钱软件
  • 网站 url 如何设计网络销售培训学校
  • 网站开发项目的心得体会产品网站推广
  • wordpress 微信 商城模板seo快速排名软件
  • 怎么做提升自己的网站交换链接名词解释
  • 辽宁阜新建设学校官方网站小姐关键词代发排名
  • 张家界市建设网站现在的seo1发布页在哪里
  • 卢湾区网站建设制作廊坊seo外包公司费用
  • 什么是RabbitMQ?
  • C++ 变量初始化方式总结 | 拷贝初始化 | 列表初始化 | 值初始化
  • 力扣:2246. 相邻字符不同的最长路径
  • 深入浅出 RabbitMQ-路由模式详解
  • HTTPS有哪些优点
  • 《Python 实用项目与工具制作指南》· 2.3 导入