android中的Bas64为何缺少 ==

android中的Bas64为何缺少 ==

前言

在逆向xxxx哩App,寻找did参数生成方法时,发现如下代码生成的Base64编码与python模拟生成的结果差别在最后的两个==

java丢失了==python中有==

这里第二个参数传入的是11,不知道什么意思~
在这里插入图片描述

分析

生成代码如下:

Base64.encode(bytes, 11)

且其第二个参数flags传入的是11,然后查看导入的是哪个包的Base64,去找源代码看看

查看发现导入的是这个包中的Base64

import android.util.Base64;

其源码如下图所示
在这里插入图片描述
标志位说明:

flags说明注释flag
DEFAULTDefault values for encoder/decoder flags.默认模式0
NO_PADDINGEncoder flag bit to omit the padding ‘=’ characters at the end of the output (if any).省略末尾填充的’='字符1
NO_WRAPEncoder flag bit to omit all line terminators (i.e., the output will be on one long line).省略所有的终止符2
CRLFEncoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF.指示行的编码器标志位用CRLF替代LF4
URL_SAFEEncoder/decoder flag bit to indicate using the “URL and filename safe” variant of Base64 (see RFC 3548 section 4) where - and _ are used in place of + and /.URL和文件名安全方式,替换其中不符合url安全的字符如+和/8
NO_CLOSEFlag to pass to Base64OutputStream to indicate that it should not close the output stream it is wrapping when it itself is closed.传递给Base64OutputStream标记以指示它本身关闭时不应关闭它正在包装的输出流16

所以

return new String(Base64.encode(bytes, 11));

中的,11=1+2+8,即:NO_PADDINGNO_WRAPURL_SAFE

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

飞得更高肥尾沙鼠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值