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

SunthyCloud阿里云国际版分销商注册教程,即可PayPal信用卡分销商服务器

阿里云国际版注册认证教程-免绑卡-免实名买服务器安全、便宜、可靠、良心,支持人民币充值,提供代理折扣简介SunthyCloud成立于2015年,是阿里云国际版正规战略级渠道商,也是阿里云国际版最大的分销商,专业为全球企业客户提供阿里云国际版开户注册、认证、充值等服务,通过SunthyCloud开通阿里云国际版只需要一个邮箱,不需要PayPal信用卡就可以帮你开通、充值、新购、续费阿里云国际版,服务...

无忧云:服务器100G高防云服务器,bgpBGP云,洛阳BGP云服务器2核2G仅38.4元/月起

无忧云怎么样?无忧云值不值得购买?无忧云,无忧云是一家成立于2017年的老牌商家旗下的服务器销售品牌,现由深圳市云上无忧网络科技有限公司运营,是正规持证IDC/ISP/IRCS商家,主要销售国内、中国香港、国外服务器产品,线路有腾讯云国外线路、自营香港CN2线路等,都是中国大陆直连线路,非常适合免备案建站业务需求和各种负载较高的项目,同时国内服务器也有多个BGP以及高防节点。目前,四川雅安机房,4...

Friendhosting 黑色星期五 VDS/VPS可享四五折优惠促销

Friendhosting商家在前面的篇幅中也又陆续介绍到,是一家保加利亚主机商,主要提供销售VPS和独立服务器出租业务,数据中心分布在:荷兰、保加利亚、立陶宛、捷克、乌克兰和美国洛杉矶等。这不近期黑色星期五活动,商家也有推出了黑五优惠,VPS全场一次性45折,虚拟主机4折,全球多机房可选,老用户续费可获9折加送1个月使用时长,VDS折后最低仅€14.53/年,有需要的可以看看。Friendhos...

blowfish为你推荐
onboardon board是什么意思?showwindowvfp中菜单生成不能运行,提示说要把showwindow属性设为2,不懂求解slideshare佳能复印MG3620怎么使用?tvos智能电视都什么功能被广电封杀了?waves插件请问下waves9是什么东西,插件吗?欢迎页面如何设置电脑的欢迎界面?社工库网站怎么找社工库?qq业务中心QQ业务办理优众网瑞达恒慧讯网是做什么的?药品标准查询药品国家标准怎么查阅
jsp虚拟主机 域名是什么 瓦工 gomezpeer 铁通流量查询 100m免费空间 元旦促销 毫秒英文 已备案删除域名 共享主机 linux使用教程 网站在线扫描 跟踪路由命令 服务器维护 国内域名 腾讯网盘 sonya alertpay easypanel 超低价 更多