Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
618 B
1
Indexable
Never
// Print results
    printBN("Alice's Public Key (ya): ", ya);
    printBN("Bob's Public Key (yb): ", yb);
    printBN("Shared Secret (Kab) as calculated by Alice: ", Kab_a);
    printBN("Shared Secret (Kab) as calculated by Bob: ", Kab_b);

    // Free memory
    BN_free(p);
    BN_free(g);
    BN_free(xa);
    BN_free(xb);
    BN_free(ya);
    BN_free(yb);
    BN_free(Kab_a);
    BN_free(Kab_b);
    BN_CTX_free(ctx);
}

int main() {
    printf("Task 1:\n");
    diffie_hellman(773, 2, 333, 603);
    
    printf("\nTask 2:\n");
    diffie_hellman(1553, 307, 1333, 807);

    return 0;
}
Leave a Comment