我目前正在尝试为开源服务器实现谷歌身份验证器,他们有这么少的代码
if (securityFlags & 0x01) // PIN input
{
pkt << uint32(0);
pkt << uint64(0) << uint64(0); // 16 bytes hash?
// This triggers the 2 factor authenticator entry to popup on the client side
}
if (securityFlags & 0x02) // Matrix input
{
pkt << uint8(0);
pkt << uint8(0);
pkt << uint8(0);
pkt << uint8(0);
pkt << uint64(0);
}
if (securityFlags & 0x04) // Security token input
{
pkt << uint8(1);
}
Run Code Online (Sandbox Code Playgroud)
我只想弄清楚他们使用的原因pkt << uint32(0),因为它们对我来说似乎完全是多余的.而且他们也经常使用它,这使得它更没意义.
为什么他们的代码是这样编写的?
mar*_*inj 11
运算符<<为ByteBuffer重载(这是一个pkt类型),它看起来如下:
ByteBuffer& operator<<(uint8 value)
{
append<uint8>(value);
return *this;
}
Run Code Online (Sandbox Code Playgroud)
所以它不是0的移位,而是附加值0.
| 归档时间: |
|
| 查看次数: |
255 次 |
| 最近记录: |