-
Notifications
You must be signed in to change notification settings - Fork 606
Closed
Description
The behavior of KDFs with BLAKE is different since your recent BLAKE-related commits. So far I've observed discrepancies with other libraries with HKDF and PBKDF2, but there could be others as well.
#include <botan/kdf.h>
#include <botan/hash.h>
int main(void)
{
const auto hasher = ::Botan::HashFunction::create("Blake2b(512)");
const auto hash = hasher->final();
for (size_t i = 0; i < hash.size(); i++) {
printf("%02X ", hash[i]);
}
printf("\n");
auto hkdf = ::Botan::KDF::create("HKDF(Blake2b(512))");
const auto derived = hkdf->derive_key(16,
std::vector<uint8_t>{},
std::vector<uint8_t>{},
std::vector<uint8_t>{});
for (size_t i = 0; i < derived.size(); i++) {
printf("%02X ", derived[i]);
}
printf("\n");
return 0;
}
Output previously (commit 378072e):
78 6A 02 F7 42 01 59 03 C6 C6 FD 85 25 52 D2 72 91 2F 47 40 E1 58 47 61 8A 86 E2 17 F7 1F 54 19 D2 5E 10 31 AF EE 58 53 13 89 64 44 93 4E B0 4B 90 3A 68 5B 14 48 B7 55 D5 6F 70 1A FE 9B E2 CE
52 06 A9 7D 30 36 7E CB 2D B3 37 21 E4 A7 47 36
Output now (commit 83c949d):
78 6A 02 F7 42 01 59 03 C6 C6 FD 85 25 52 D2 72 91 2F 47 40 E1 58 47 61 8A 86 E2 17 F7 1F 54 19 D2 5E 10 31 AF EE 58 53 13 89 64 44 93 4E B0 4B 90 3A 68 5B 14 48 B7 55 D5 6F 70 1A FE 9B E2 CE
AD 61 A6 64 11 ED 9C 9D 42 43 D7 78 94 56 D8 7B
noloader
Metadata
Metadata
Assignees
Labels
No labels