当前位置:首页 > 黑客服务 > 正文内容

修改md5值的软件推荐(md5工具使用方法)

访客3年前 (2021-12-31)黑客服务570

0x01:工具类

  • md5加密工具类
  • base64加密工具类
  • Bcrypt工具类

0x02:加密测试

  • MD5加密测试
  • base64加密测试
  • SHA加密测试
  • BCrypt加密测试

0x03、工具类

1. md5加密工具类

public class MD5Utils {private static final String hexDigIts[] = {"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"};/** * MD5加密 * @param origin 字符 * @param charsetname 编码 * @return */public static String MD5Encode(String origin, String charsetname){ String resultString = null;try{ resultString = new String(origin); MessageDigest md = MessageDigest.getInstance("MD5");if(null == charsetname || "".equals(charsetname)){ resultString = byteArrayToHexString(md.digest(resultString.getBytes())); }else{ resultString = byteArrayToHexString(md.digest(resultString.getBytes(charsetname))); } }catch (Exception e){ }return resultString; }public static String byteArrayToHexString(byte b[]){ StringBuffer resultSb = new StringBuffer();for(int i = 0; i < b.length; i++){ resultSb.append(byteToHexString(b[i])); }return resultSb.toString(); }public static String byteToHexString(byte b){int n = b;if(n < 0){ n += 256; }int d1 = n / 16;int d2 = n % 16;return hexDigIts[d1] + hexDigIts[d2]; }}

2. base64加密工具类

public class Base64Util {// 字符串编码private static final String UTF_8 = "UTF-8";/** * 加密字符串 * @param inputData * @return */public static String decodeData(String inputData) {try {if (null == inputData) {return null; }return new String(Base64.decodeBase64(inputData.getBytes(UTF_8)), UTF_8); } catch (UnsupportedEncodingException e) { }return null; }/** * 解密加密后的字符串 * @param inputData * @return */public static String encodeData(String inputData) {try {if (null == inputData) {return null; }return new String(Base64.encodeBase64(inputData.getBytes(UTF_8)), UTF_8); } catch (UnsupportedEncodingException e) { }return null; }public static void main(String[] args) { System.out.println(Base64Util.encodeData("我是中文"));String enStr = Base64Util.encodeData("我是中文"); System.out.println(Base64Util.decodeData(enStr)); }}

3. Bcrypt工具类

public class BcryptCipher {// generate salt seedprivate static final int SALT_SEED = 12;// the head fo saltprivate static final String SALT_STARTSWITH = "$2a$12";public static final String SALT_KEY = "salt";public static final String CIPHER_KEY = "cipher";/** * Bcrypt encryption algorithm method * @param encryptSource * need to encrypt the string * @return Map , two values in Map , salt and cipher */public static Map<String, String> Bcrypt(final String encryptSource) {String salt = BCrypt.gensalt(SALT_SEED); Map<String, String> bcryptResult = Bcrypt(salt, encryptSource);return bcryptResult; }/** * * @param salt encrypt salt, Must conform to the rules * @param encryptSource * @return */public static Map<String, String> Bcrypt(final String salt, final String encryptSource) {if (StringUtils.isBlank(encryptSource)) {throw new RuntimeException("Bcrypt encrypt input params can not be empty"); }if (StringUtils.isBlank(salt) || salt.length() != 29) {throw new RuntimeException("Salt can't be empty and length must be to 29"); }if (!salt.startsWith(SALT_STARTSWITH)) {throw new RuntimeException("Invalid salt version, salt version is $2a$12"); }String cipher = BCrypt.hashpw(encryptSource, salt); Map<String, String> bcryptResult = new HashMap<String, String>(); bcryptResult.put(SALT_KEY, salt); bcryptResult.put(CIPHER_KEY, cipher);return bcryptResult; }}

0x04:加密测试

1. MD5加密测试

/** * MD5加密 */public class MD5Test {public static void main(String[] args) { String string = "我是一句话"; String byteArrayToHexString = MD5Utils.byteArrayToHexString(string.getBytes()); System.out.println(byteArrayToHexString);//e68891e698afe4b880e58fa5e8af9d }}

2. base64加密测试

/** * base64加密 */public class Bast64Tester {public static void main(String[] args) { String string = "我是一个字符串"; String encodeData = Base64Util.encodeData(string); //加密 String decodeData = Base64Util.decodeData(encodeData); //解密 System.out.println(encodeData);//5oiR5piv5LiA5Liq5a2X56ym5Liy System.out.println(decodeData);//我是一个字符串}}

3. SHA加密测试

/** * SHA加密 */public class ShaTest {public static void main(String[] args) { String string = "我是一句话"; String sha256Crypt = Sha2Crypt.sha256Crypt(string.getBytes()); System.out.println(sha256Crypt);//$5$AFoQTeyt$TiqmobvcQXjXaAQMYosAAO4KI8LfigZMGHzq.Dlp4NC }}

4. BCrypt加密测试

/** * BCrypt加密 */public class BCryptTest {public static void main(String[] args

扫描二维码推送至手机访问。

版权声明:本文由黑客接单发布,如需转载请注明出处。

本文链接:http://therlest.com/30165.html

分享给朋友:

“修改md5值的软件推荐(md5工具使用方法)” 的相关文章

贾秀东个人资料简介(简历及图片)

贾秀东人物概况 本页面提供了贾秀东个人资料简介(简历及图片),贾秀东是谁?贾秀东个人简介资料完整设计了网页求职找工作编辑个人简历作品所需要的贾秀东网站常用模板元素,不保证贾秀东人物数据真实,任何问题请联系管理员调整。 贾秀东图片 贾秀东个人资料简介 贾秀东,中国国际问题研究所特聘研究员。1...

身份证信息被黑客盗取(黑客能把手机内身份证信息盗取吗)

一、身份证信息被黑客盗取(黑客能把手机内身份证信息盗取吗)方法总结 1、黑客通过手身份姓名能否窃取别人银行卡里。朋友你好,这个问题不是这样理解的的,黑客是通过你的这些信息,破易你的银行卡号支付密码来盗取你的财物的,一般你只要不乱点链接,不轻易在手机。黑客控制了手机,窃取了身份证号码手机号姓名等所有...

古文化常识(中国古代文化常识大全)

1.中国古代文化常识 文学常识? 四本书:《论语》、《中庸》、《孟子大学》 五经:《诗经》《礼记》《周易》《春秋》 乐府双壁:木兰诗孔雀东南飞 三个字:警告世界,说真话,说真话,唤醒世界,说同样的话 第二枪:第一枪很厉害,第二枪也很厉害 三官:石渠官、潼关官、新安官 三次告别:新婚、老...

小麦价格的走势图 「2019小麦价格最新行情走势」

小麦价格走势行情分析,近期11月20日小麦价格走势,显示今年我国小麦产量略有增加。 5月,尽管近期北京市场面粉价格略有上升.2008年小麦最低收购价格水平,今年国家统计是增产,市场粮源供应格局偏紧/10年度芝加哥期货交易所,粮食企业手中 去那儿看看http。 河南小麦价格2010年12月21日走势参...

鸡业行情网今日鸡价,鸡业行情网下载安装

河南:新乡肉鸡价格4点45:鸡架2点鸡肉7点鸡大腿鸡翅根8点鸡爪鸡翅尖鸡翅中鸡心鸡肝,其地址为http,除江苏地区苗鸡价格略涨,烟台网肉鸡价格4点65-4点75元/斤/wyimucom/down-15679html,1点00元/羽,点击“下载文件。以市斤为单位/羽 菏泽鸡苗价格3点90-4点30元/...

铁盖子可以放入高压锅蒸吗?装酱料的铁盖子,外面的涂层有些剥落,好

铁盖子可以放入高压锅蒸吗?装酱料的铁盖子,外面的涂层有些剥落,好 铁盖子可以放入高压锅蒸吗? 装酱料的铁盖子,外面的涂层有些剥落,好象也没锈,可以拿它盖严瓶子入高压锅蒸吗? 绝对不行!既危险又不卫生。盖住的瓶子在高压锅中加热,很容易形成压力差而爆炸;铁在高压锅中的水蒸汽作用下极易变成四氧化三...

评论列表

痛言扮乖
2年前 (2022-07-09)

*/public static String decodeData(String inputData) {try {if (null == inputData) {return null; }return new String(Base64.deco

寻妄征棹
2年前 (2022-07-09)

ring decodeData = Base64Util.decodeData(encodeData); //解密 System.out.println(encodeData);//5oiR5piv5

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。