X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=lookup.c;h=35c039bf906c8c9d59e8706e052261f9dd481cc9;hb=85187675424f3854869f1607afd8a1e84e536946;hp=91371b43b1b72e3c046407739d4c3a313c5742e2;hpb=a799cc2909f47d918d1ec7171a9edba28a9f5136;p=onak.git diff --git a/lookup.c b/lookup.c index 91371b4..35c039b 100644 --- a/lookup.c +++ b/lookup.c @@ -147,8 +147,20 @@ int main(int argc, char *argv[]) params[i+1] = NULL; if (search != NULL && strlen(search) == 42 && search[0] == '0' && search[1] == 'x') { - fingerprint.length = MAX_FINGERPRINT_LEN; - for (j = 0; j < MAX_FINGERPRINT_LEN; j++) { + /* v4 fingerprint */ + fingerprint.length = 20; + for (j = 0; j < 20; j++) { + fingerprint.fp[j] = (hex2bin( + search[2 + j * 2]) + << 4) + + hex2bin(search[3 + j * 2]); + } + isfp = true; + } else if (search != NULL && strlen(search) == 66 && + search[0] == '0' && search[1] == 'x') { + /* v5 fingerprint */ + fingerprint.length = 32; + for (j = 0; j < 32; j++) { fingerprint.fp[j] = (hex2bin( search[2 + j * 2]) << 4) +