mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-29 13:01:14 +03:00
Use LIBSSH2_HOSTKEY_HASH_SHA1 instead of _MD5 in examples and tests
MD5 support is optional and may not always be available, while SHA1 is both required and recommended.
This commit is contained in:
@ -126,9 +126,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
fprintf(stderr, "Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++)
|
for(i = 0; i < 20; i++)
|
||||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
fprintf(stderr, "Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -160,9 +160,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
fprintf(stderr, "Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -118,9 +118,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
fprintf(stderr, "Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -126,9 +126,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
fprintf(stderr, "Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -136,9 +136,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
fprintf(stderr, "Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -109,9 +109,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -105,9 +105,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -108,9 +108,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -161,9 +161,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
fprintf(stderr, "Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
@ -123,9 +123,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -127,9 +127,9 @@ int main(int argc, char *argv[])
|
|||||||
* have it hard coded, may go to a file, may present it to the user,
|
* have it hard coded, may go to a file, may present it to the user,
|
||||||
* that's your call
|
* that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -105,9 +105,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -111,9 +111,9 @@ int main(int argc, char *argv[])
|
|||||||
* may have it hard coded, may go to a file, may present it to the
|
* may have it hard coded, may go to a file, may present it to the
|
||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -121,9 +121,9 @@ int main(int argc, char *argv[])
|
|||||||
* hard coded, may go to a file, may present it to the user, that's your
|
* hard coded, may go to a file, may present it to the user, that's your
|
||||||
* call
|
* call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -150,9 +150,9 @@ int main(int argc, char *argv[])
|
|||||||
* hard coded, may go to a file, may present it to the user, that's your
|
* hard coded, may go to a file, may present it to the user, that's your
|
||||||
* call
|
* call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -90,9 +90,9 @@ int main(int argc, char *argv[])
|
|||||||
* The first thing to do is check the hostkey's fingerprint against our known hosts
|
* The first thing to do is check the hostkey's fingerprint against our known hosts
|
||||||
* Your app may have it hard coded, may go to a file, may present it to the user, that's your call
|
* Your app may have it hard coded, may go to a file, may present it to the user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_MD5);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
printf("Fingerprint: ");
|
||||||
for(i = 0; i < 16; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
printf("%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
Reference in New Issue
Block a user