| 36 | } |
| 37 | |
| 38 | static bool ta_unhex(const char *hex, unsigned char bytes[32]) { |
| 39 | if (!hex || strlen(hex) != 64) { |
| 40 | return false; |
| 41 | } |
| 42 | for (int i = 0; i < 64; i++) { |
| 43 | char ch = hex[i]; |
| 44 | int v = ch >= '0' && ch <= '9' ? ch - '0' : ch >= 'a' && ch <= 'f' ? ch - 'a' + 10 : -1; |
| 45 | if (v < 0) { |
| 46 | return false; |
| 47 | } |
| 48 | bytes[i / 2] = (unsigned char)(i % 2 ? (bytes[i / 2] | v) : (v << 4)); |
| 49 | } |
| 50 | return true; |
| 51 | } |
| 52 | |
| 53 | /* The exact graph digest of a database: what an importer of it measures. */ |
| 54 | bool te_db_digest(const char *db_path, char hex[65]) { |
no outgoing calls
no test coverage detected