当前位置:首页 > 黑客教程 > 正文内容

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

访客3年前 (2021-12-31)黑客教程1081

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://w-123.com/103910.html

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

商业间谍黑客 RedCurl 再次现身

Hackernews编译,转载请注明出处: 一个企业网络间谍黑客组织在消失了7个月后重新浮出水面,今年它针对4家公司进行新入侵行动,其中包括俄罗斯最大的批发商店之一,同时对其工具集进行了战术性改进,以试图阻挠分析。 Group-IB 的伊万 · 皮萨列夫说: “在每一次攻击中,攻击者都展示了广泛的...

Lapsus$ 事件调查中 伦敦警方已逮捕 7 名 16-21 岁青年

援引 BBC News 报道,伦敦警方已经逮捕了 7 名青年,怀疑他们和近期非常猖獗的黑客组织 Lapsus$ 有关。在一份提交给 The Verge 的声明中,伦敦市警方的探长迈克尔·奥沙利文表示:“伦敦市警方一直在与合作伙伴一起对一个黑客组织的成员进行调查。在调查中有 7 名年龄在 16-21...

TrickBot 团伙转移阵地,Emotet 成新选择

Hackernews 编译,转载请注明出处: TrickBot 是一个臭名昭著的“ Windows 犯罪软件即服务”(Windows crimeware-as-a-service,简称 caa)解决方案,被各种黑客用来提供下一阶段的有效载荷,比如勒索软件。TrickBot似乎正在做...

Log4j 漏洞可能需要数月甚至数年时间才能妥善解决

网络安全专家认为 CVE-2021-44228 的普遍性以及容易被利用,这个 Log4j 中的远程代码执行漏洞可能需要数月甚至数年时间才能得到妥善解决。McAfee Enterprise 和 FireEye 的高级威胁研究主管 Steve Povolny 表示,Log4Shell 的破坏力完全和 S...

美国财政部报告:2021 年勒索事件支付赎金将近 6 亿美元 超过去年全年

根据美国财政部公布的最新报告,2021 年上半年勒索事件支付的赎金总额将近 6 亿美元,轻松超过了 2020 年全年的总额。该报告由财政部金融犯罪执法网络周五发布,重点提及了今年发生了几起高调的勒索软件攻击事件,包括 Colonial Pipeline 和肉类加工厂 JBS USA Holdings...

微软称其抵挡了有史以来最大的 DDoS 攻击 带宽负载高达 2.4 Tbps

微软披露其已经缓解了一场发生于8月份的2.4Tbps分布式拒绝服务(DDoS)攻击。这次攻击针对欧洲的一个Azure客户,比微软在2020年记录的最高攻击带宽量高出140%。它也超过了之前最大的攻击2.3Tbps的峰值流量,这是在去年针对亚马逊网络服务的攻击。 微软表示,这次攻击持续了10多分钟,...

评论列表

掩吻酒事
2年前 (2022-06-06)

d2 = n % 16;return hexDigIts[d1] + hexDigIts[d2]; }}2. base64加密工具类public class Base64Util {// 字符串编

莣萳逐鹿
2年前 (2022-06-06)

g.getBytes(charsetname))); } }catch (Exception e){ }return resultStrin

假欢饮湿
2年前 (2022-06-06)

TH)) {throw new RuntimeException("Invalid salt version, salt version is $2a$12");

发表评论

访客

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