blowfish加密算法之BLOWFISH算法有何特点

blowfish  时间:2021-07-04  阅读:()

有谁会写java的Blowfish-CBC加密算法吗?

public class BlowfishAlgorithmEncryptor { public static final Integer BLOWFISH_IVLENGTH = 8; public static final Integer BLOWFISH_KEYSIZE = 128; public static final String BLOWFISH_ALGORITHM = "Blowfish"; public static final String BLOWFISH_CBC_PKCS5PADDING = "Blowfish/CBC/PKCS5Padding"; private Key key; public Key initialKey() { try { KeyGenerator keyGenerator = KeyGenerator .getInstance(BLOWFISH_ALGORITHM); keyGenerator.init(BLOWFISH_KEYSIZE.intValue()); key = keyGenerator.generateKey(); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } return key; } public byte[] encrypt(byte[] plainBytes) { try { ByteArrayInputStream inputStream = new ByteArrayInputStream( plainBytes); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); SecureRandom random = new SecureRandom(); byte[] iv = new byte[BLOWFISH_IVLENGTH]; random.nextBytes(iv); Cipher cipher = getCipher(Cipher.ENCRYPT_MODE, iv); outputStream.write(iv); CipherOutputStream cipherStream = new CipherOutputStream( outputStream, cipher); for (int i = inputStream.read(); i != -1; i = inputStream.read()) { cipherStream.write(i); } inputStream.close(); cipherStream.close(); outputStream.close(); return outputStream.toByteArray(); } catch (Exception e) { e.printStackTrace(); return null; } } public byte[] decrypt(byte[] cipherBytes) { try { ByteArrayInputStream inputStream = new ByteArrayInputStream( cipherBytes); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] iv = new byte[BLOWFISH_IVLENGTH]; inputStream.read(iv); Cipher cipher = getCipher(Cipher.DECRYPT_MODE, iv); CipherInputStream cipherStream = new CipherInputStream(inputStream, cipher); for (int i = cipherStream.read(); i != -1; i = cipherStream.read()) { outputStream.write(i); } inputStream.close(); cipherStream.close(); outputStream.close(); return outputStream.toByteArray(); } catch (Exception e) { e.printStackTrace(); return null; } } private Cipher getCipher(int mode, byte[] iv) { IvParameterSpec spec = new IvParameterSpec(iv); try { Cipher cipher = Cipher.getInstance(BLOWFISH_CBC_PKCS5PADDING); cipher.init(mode, key, spec); return cipher; } catch (Exception e) { e.printStackTrace(); return null; } } }

TrueCrypt是全球最著名、最权威的硬盘加密软件之一?

TrueCrypt是全球最著名、最权威的硬盘加密软件之一,迄今为止没有任何方法可以破解其加密的磁盘。

它拥有AES-256、Blowfish(448-bitkey)、CAST5、Serpent、Triple DES三种加密算法。

支持长密码,如果长度为20位,暴力破解需要1056993066125年时间!它的加密方式有三种:将文件虚拟为分区来加密,对分区乃至整个硬盘加密,对操作系统加密。

本文将选用其中的分区加密。

  

  运行下载回来的TrueCrypt Setup 6.2a.exe,可选择“Install”(安装)、“Extract”(解压)。

考虑到还要将其拷贝到移动硬盘上使用,请选择“Extract”,直到完成。

接着,将中文补丁解压,再拷贝到TrueCrypt的解压目录。

然后运行解压目录中的TrueCrypt,在程序主界面上单击“Settings”下的“Language”,再选择简体中文,整个程序即可中文化。

加密算法之BLOWFISH算法有何特点

AES-256和RSA-2048绝对可以,用RSA加密密匙,AES加密数据,因为非对称算法加密数据速度实在太慢,所以用非对称算法加密数据根本行不通,但是安全性非常高。

ZJI(月付480元),香港阿里云专线服务器

ZJI是成立于2011年原Wordpress圈知名主机商—维翔主机,2018年9月更名为ZJI,主要提供香港、日本、美国独立服务器(自营/数据中心直营)租用及VDS、虚拟主机空间、域名注册业务。本月商家针对香港阿里云线路独立服务器提供月付立减270-400元优惠码,优惠后香港独立服务器(阿里云专线)E3或者E5 CPU,SSD硬盘,最低每月仅480元起。阿里一型CPU:Intel E5-2630L...

Megalayer美国独立服务器配置及性能速度综合评测

Megalayer 商家在之前也有记录过,商家开始只有提供香港站群服务器和独立服务器,后来也有增加到美国独立服务器,以及前几天也有介绍到有增加香港VPS主机。对于香港服务器之前有过评测(Megalayer香港服务器配置一览及E3-1230 8GB服务器评测记录),这里申请到一台美国独立服务器,所以也准备简单的评测记录。目前市场上我们看到很多商家提供VPS或者云服务器基本上没有什么特别的,但是独立服...

wordpress简洁英文主题 wordpress简洁通用型高级外贸主题

wordpress简洁英文主题,wordpress简洁通用大气的网站风格设计 + 更适于欧美国外用户操作体验,完善的外贸企业建站功能模块 + 更好的移动设备特色模块支持,更高效实用的后台自定义设置 + 标准高效的代码程序功能结构,更利于Goolge等国际搜索引擎的SEO搜索优化和站点收录排名。点击进入:wordpress简洁通用型高级外贸主题主题价格:¥3980 特 惠 价:¥1280安装环境:运...

blowfish为你推荐
元数据管理四大管理是什么微信收款语音播报怎么设置两部手机微信收款语音播报怎么设置weakhashmap在Java中ArrayList、LinkedList、HashMap的区别是什么策略组组策略完全使用方法qq号查询现成的qq号和密码查询oracle索引Oracle中有多少种索引类型bindservice如何启动和停止用service欢迎页面怎样取消“欢迎页面”?ruby语言ruby什么意思?什么含义?jsindexofjavascript 中indexof 的用法
哈尔滨服务器租用 怎么申请域名 阿云浏览器 唯品秀 namecheap 监控宝 免费名片模板 iis安装教程 512m内存 空间出租 双11秒杀 福建铁通 网通服务器托管 四核服务器 如何建立邮箱 沈阳主机托管 vul 东莞服务器托管 移动王卡 xshell5注册码 更多