1. 使用了【hutool】hutool类库的Base64和zip工具类,用来压缩二维码中的长json字符串。
  2. 自定义工具类:
public final class QrGzipUtil {

    // 压缩
    public static String gzip(String toGzip) {
        return Base64.encode(ZipUtil.gzip(toGzip, CharsetUtil.CHARSET_UTF_8.name()));
    }

    // 解压
    public static String unGzip(String toUnGzip) {
        byte[] decode = Base64.decode(toUnGzip);
        return ZipUtil.unGzip(decode , CharsetUtil.CHARSET_UTF_8.name());
    }
}
  1. PS,发送端在数据发送前的处理流程如下(接收端互逆):

1.先对原始字符串签名,以保证签名忠实于原始内容;
2.然后压缩,以精简内容的尺寸,提高后续加密和传输的效率;
3.最后加密,保证数据安全。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-15
  • 2022-02-19
  • 2021-08-17
  • 2022-01-19
  • 2021-08-29
相关资源
相似解决方案