Open
Bug 804326
Opened 13 years ago
Updated 3 years ago
Do something with mozilla::SHA1Sum::Hash
Categories
(Core :: MFBT, defect)
Core
MFBT
Tracking
()
NEW
People
(Reporter: justin.lebar+bug, Unassigned)
References
Details
Right now, mozilla::SHA1Sum::Hash is a typedef for uint8_t[20].
That's not very useful, because when I see code like:
SHA1Sum::Hash hash = /* whatever */;
for (int i = 0; i < sizeof(hash); i++) {
foo(hash[i]);
}
it's not clear what type hash[i] has; nor is it clear that the loop condition is correct. Explicit is better than implicit, so better would be
uint8_t[SHA1Sum::HashLength] hash;
for (...) {...}
There are a few things we could do here. We could just eliminate this typedef and use uint8_t[20], which would be fine with me. Or we could make SHA1Sum::Hash a proper class with ToByteArray() and ToHexString(char*) functions.
Any thoughts on this?
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•