Use a constant-time compare #366

Closed
sarah wants to merge 1 commits from soatok/cwtch:master into master
1 changed files with 3 additions and 4 deletions

View File

@ -37,12 +37,11 @@ func compareSignatures(a []byte, b []byte) bool {
if len(a) != len(b) {
return false
}
int d = 0
for i := range a {
if a[i] != b[i] {
return false
}
d := d | (a[i] ^ b[i])
Review

isn't d going to be shadowed here? (should be = instead of := I think)

isn't d going to be shadowed here? (should be `=` instead of `:=` I think)
}
return true
return d == 0
}
// GetMessages returns a copy of the entire timeline