1 Star 0 Fork 0

igeekfan / Tools

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

Tools 工具预览包

目标:实现在线预览,加密、编码、转换等工具,功能点如下:

  • MD5 信息-摘要算法
  • SM4/SM3/SM2国密
  • DES
  • AES
  • BASE64
  • URI 编码
  • JSON格式化
  • 图片验证码(跨平台)
  • 时间戳

预览地址

示例 DES

  • JAVA+C# 相同的DES 加密/解密

C# 调用

    string password = "12345678";
    string sourceString = "{'idcard':'330781198509077211','date':'2021-11-11 19:04'}";
    Console.WriteLine("源字符串:" + sourceString);
    var c = DESUtil.Encrypt(sourceString, password);
    //加密:3tL0BBKZyUpIfO+XJKL1VoeQhEWc0enGG8R//RPBJQCiykspXEBmvabp8yrWTBv+QUL62K7dUL+vbpYV/PwZvw==
    Console.WriteLine("加密:" + c);

    c = HttpUtility.UrlEncode(c);
    Console.WriteLine("url编码:" + c);

    Console.WriteLine("================");

    c = HttpUtility.UrlDecode(c);
    Console.WriteLine("url解码:" + c);

    try
    {
        c = DESUtil.Decrypt(c, password);
        Console.WriteLine("url解密:" + c);

        var user = JsonConvert.DeserializeObject<User>(c);
        Console.WriteLine("反序列化\n日期:" + user.date);
        Console.WriteLine("身份证号:" + user.idcard);

    }
    catch (Exception e)
    {
        Console.WriteLine("无法解密:" + e.StackTrace + e.Message);
    }

    Console.WriteLine("------over--------");
    Console.ReadLine();

JAVA调用

    String password="12345678";

    String den = DESUtil.encrypt("{'idcard':'330781198509077211','date':'2021-11-11 19:04'}",password);
    System.out.println("加密:"+den);

    String CHARSET="utf-8";
    String encodeStr= URLEncoder.encode(den,CHARSET);
    System.out.println("url编码:"+den);

    String decodeUrl=URLDecoder.decode(encodeStr,CHARSET);
    System.out.println("url解码:"+decodeUrl);

    String ert = DESUtil.decrypt(decodeUrl,password);
    System.out.println("url解密:"+ert);

Empty file

About

Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
C#
1
https://gitee.com/igeekfan/Tools.git
git@gitee.com:igeekfan/Tools.git
igeekfan
Tools
Tools
master

Search

53164aa7 5694891 3bd8fe86 5694891