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加密数据,因为非对称算法加密数据速度实在太慢,所以用非对称算法加密数据根本行不通,但是安全性非常高。

tmhhost(100元/季)自带windows系统,香港(三网)cn2 gia、日本cn2、韩国cn2、美国(三网)cn2 gia、美国cn2gia200G高防

tmhhost可谓是相当熟悉国内网络情况(资质方面:ISP\ICP\工商齐备),专业售卖海外高端优质线路的云服务器和独立服务器,包括了:香港的三网cn2 gia、日本 cn2、日本软银云服务器、韩国CN2、美国三网cn2 gia 云服务器、美国 cn2 gia +200G高防的。另外还有国内云服务器:镇江BGP 大连BGP数据盘和系统盘分开,自带windows系统,支持支付宝付款和微信,简直就是专...

HostYun(22元/月)全场88折优惠香港原生IP大带宽

在之前的一些文章中有提到HostYun商家的信息,这个商家源头是比较老的,这两年有更换新的品牌域名。在陆续的有新增机房,价格上还是走的低价格路线,所以平时的折扣力度已经是比较低的。在前面我也有介绍到提供九折优惠,这个品牌商家就是走的低价量大为主。中秋节即将到,商家也有推出稍微更低的88折。全场88折优惠码:moon88这里,整理部分HostYun商家的套餐。所有的价格目前都是原价,我们需要用折扣码...

美国服务器20G防御 50G防御 688元CN2回国

全球领先的IDC服务商华纳云“美国服务器”正式发售啦~~~~此次上线的美国服务器包含美国云服务器、美国服务器、美国高防服务器以及美国高防云服务器。针对此次美国服务器新品上线,华纳云也推出了史无前例的超低活动力度。美国云服务器低至3折,1核1G5M低至24元/月,20G DDos防御的美国服务器低至688元/月,年付再送2个月,两年送4个月,三年送6个月,且永久续费同价,更多款高性价比配置供您选择。...

blowfish为你推荐
一物一码一码归一码的上句是什么?微信收款语音播报怎么设置微信收款码声音怎么设置洗牌算法关于洗牌算法,请用JAVA编写,定义一个数组,储存1-52以内的数,打乱顺序输出!md5值文件名后缀为MD5是什么文件。foxmail邮箱注册Foxmail怎么注册喏?最开放的浏览器目前最好的游览器?rdlDVD±RW/±RDL/RAM 具体什么意思rdlcordless phone是什么意思拓扑关系拓扑关系在GIS中的作用备忘录模式为什么我的华为手机界面总是有个框框在备忘录上面
中国万网虚拟主机 linuxapache虚拟主机 西安服务器 bbr tightvnc 一元域名 牛人与腾讯客服对话 个人域名 web服务器架设 gspeed 699美元 免费申请网站 hkt 33456 idc查询 电信托管 shopex主机 cloudlink 台湾google 上海电信测速 更多