前言
在逆向xxxx哩App,寻找did
参数生成方法时,发现如下代码生成的Base64编码与python模拟生成的结果差别在最后的两个==
java丢失了==
,python中有==
这里第二个参数传入的是11
,不知道什么意思~
分析
生成代码如下:
Base64.encode(bytes, 11)
且其第二个参数flags传入的是11,然后查看导入的是哪个包的Base64,去找源代码看看
查看发现导入的是这个包中的Base64
import android.util.Base64;
其源码如下图所示
标志位说明:
flags | 说明 | 注释 | flag |
---|---|---|---|
DEFAULT | Default values for encoder/decoder flags. | 默认模式 | 0 |
NO_PADDING | Encoder flag bit to omit the padding ‘=’ characters at the end of the output (if any). | 省略末尾填充的’='字符 | 1 |
NO_WRAP | Encoder flag bit to omit all line terminators (i.e., the output will be on one long line). | 省略所有的终止符 | 2 |
CRLF | Encoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF. | 指示行的编码器标志位用CRLF替代LF | 4 |
URL_SAFE | Encoder/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_CLOSE | Flag 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_PADDING
、NO_WRAP
、URL_SAFE
版权声明:本文为dzdzdzd12347原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。