写了一个异或的函数
//TruncatedStepRow
template template
TruncatedStepRow::TruncatedStepRow(const TruncatedStepRow& a, const TruncatedStepRow& b, size_t len, size_t lenIndices, int lenTrim) :
StepRow {a}
{
cout<<"len="< cout<<"lenIndices="< // cout<<"lenTrim="< assert(len+lenIndices <= W);
assert(len-lenTrim+(2*lenIndices) <= WIDTH);
// unsigned char hash[len-lenTrim];
cout<<"colision hash a =";
for(long long unsigned int i=0;i cout< }
cout< cout<<"colision hash b =";
for(long long unsigned int i=0;i cout< }
cout<
for (int i = lenTrim; i < (int)len-lenTrim; i++){
hash[i-lenTrim] = a.hash[i] ^ a.hash[i];
}
// cout< print_hash(len-lenTrim);
if (a.IndicesBefore(b, len, lenIndices)) {
std::copy(a.hash+len, a.hash+len+lenIndices, hash+len-lenTrim);
std::copy(b.hash+len, b.hash+len+lenIndices, hash+len-lenTrim+lenIndices);
} else {
std::copy(b.hash+len, b.hash+len+lenIndices, hash+len-lenTrim);
std::copy(a.hash+len, a.hash+len+lenIndices, hash+len-lenTrim+lenIndices);
}
//cout< //cout< }
相同的值异或应该是0才对,为什么输出还是4或者7 啊??
template
TruncatedStepRow
StepRow
{
cout<<"len="<
assert(len-lenTrim+(2*lenIndices) <= WIDTH);
// unsigned char hash[len-lenTrim];
cout<<"colision hash a =";
for(long long unsigned int i=0;i
cout<
for(long long unsigned int i=0;i
cout<
for (int i = lenTrim; i < (int)len-lenTrim; i++){
hash[i-lenTrim] = a.hash[i] ^ a.hash[i];
}
// cout<
if (a.IndicesBefore(b, len, lenIndices)) {
std::copy(a.hash+len, a.hash+len+lenIndices, hash+len-lenTrim);
std::copy(b.hash+len, b.hash+len+lenIndices, hash+len-lenTrim+lenIndices);
} else {
std::copy(b.hash+len, b.hash+len+lenIndices, hash+len-lenTrim);
std::copy(a.hash+len, a.hash+len+lenIndices, hash+len-lenTrim+lenIndices);
}
//cout<
相同的值异或应该是0才对,为什么输出还是4或者7 啊??
全部评论
相关推荐