| 1724 | } |
| 1725 | |
| 1726 | static bool readiness_hex_decode(const char *hex, uint8_t out[CBM_SHA256_DIGEST_LEN]) { |
| 1727 | if (!hex || strlen(hex) != CBM_SHA256_HEX_LEN) { |
| 1728 | return false; |
| 1729 | } |
| 1730 | for (size_t i = 0; i < CBM_SHA256_DIGEST_LEN; i++) { |
| 1731 | int high = readiness_hex_nibble(hex[i * 2U]); |
| 1732 | int low = readiness_hex_nibble(hex[i * 2U + 1U]); |
| 1733 | if (high < 0 || low < 0) { |
| 1734 | return false; |
| 1735 | } |
| 1736 | out[i] = (uint8_t)((high << 4) | low); |
| 1737 | } |
| 1738 | return true; |
| 1739 | } |
| 1740 | |
| 1741 | static void readiness_hex_encode(const uint8_t bytes[CBM_SHA256_DIGEST_LEN], |
| 1742 | char out[CBM_SHA256_HEX_LEN + 1U]) { |
no test coverage detected