Add sha224
alphaonex86 opened this issue · comments
Hi, can you add sha224?
What exactly do you mean ?
a) SHA-224 (based on SHA2) or
b) SHA3-224
SHA-224 (based on SHA2)
I added a #define SHA2_224_SEED_VECTOR
in file sha256.cpp which is disabled by default.
If you enable it then you "almost" get SHA2/224: you still need to throw away the last 32 bits of getHash()
.
Example: an empty string will give you a hash value
d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42fbdd387cb
but the actual SHA2/224 of that empty string is
d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f
so you need to remove the last 32/4 = 8 hexadecimal characters bdd387cb
(basically getHash().resize(224/4)
will do the trick).
Since the whole class is called SHA256
I'm reluctant to fully integrate SHA2-224 and hope you can work with that limitation.