+void hash_mem_P(const hfdesc_t *hfdesc, void *dest, const void *msg, uint16_t msg_len_b){
+ uint16_t blocksize = hfal_hash_getBlocksize(hfdesc);
+ uint8_t block[blocksize / 8];
+ hfgen_ctx_t ctx;
+ hfal_hash_init(hfdesc, &ctx);
+ while(msg_len_b > blocksize){
+ memcpy_P(block, msg, blocksize / 8);
+ msg = (uint8_t*)msg + blocksize / 8;
+ msg_len_b -= blocksize;
+ hfal_hash_nextBlock(&ctx, block);
+ }
+ memcpy_P(block, msg, (msg_len_b + 7) / 8);
+ hfal_hash_lastBlock(&ctx, block, msg_len_b);
+ hfal_hash_ctx2hash(dest, &ctx);
+ hfal_hash_free(&ctx);
+}
+
+const uint8_t ecdsa_test_2_msg[] PROGMEM = {
+ 0x66, 0xa2, 0x51, 0x3d, 0x7b, 0x60, 0x45, 0xe5,
+ 0x66, 0x79, 0xb0, 0x32, 0xca, 0xd4, 0x5f, 0xb1,
+ 0x82, 0x28, 0x9c, 0xa7, 0x6a, 0x88, 0xc0, 0x6d,
+ 0x78, 0xc8, 0x5f, 0x3d, 0xd3, 0x80, 0x45, 0x90,
+ 0x20, 0x5b, 0x73, 0xa7, 0x84, 0x24, 0x9a, 0x0a,
+ 0x0c, 0x8b, 0xf2, 0xf2, 0x21, 0x45, 0xd1, 0x05,
+ 0x21, 0x9b, 0x48, 0x0d, 0x74, 0x60, 0x7c, 0x02,
+ 0xb8, 0xa6, 0xb6, 0xb4, 0x59, 0x25, 0x9e, 0x4f,
+ 0xdf, 0xe2, 0xbd, 0xb4, 0xab, 0x22, 0x38, 0x01,
+ 0x75, 0x35, 0x29, 0x1d, 0x7a, 0xc1, 0xab, 0xda,
+ 0x66, 0xc4, 0xf6, 0xdc, 0xea, 0x9e, 0x5d, 0x0b,
+ 0xf0, 0x5a, 0x93, 0x06, 0xf3, 0x33, 0xb0, 0x0e,
+ 0x56, 0x34, 0x2f, 0x75, 0x53, 0x40, 0x21, 0x1a,
+ 0xc2, 0x94, 0xac, 0x21, 0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