diff --git a/fdtextract.c b/fdtextract.c
index 236e955ed16d50686a90f61e7f449df37c9fdfd4..4357d2fc57772994043cbc3520c9616c6ef67921 100644
--- a/fdtextract.c
+++ b/fdtextract.c
@@ -42,6 +42,8 @@
 #define MAX_PATH_LEN 100
 #define SHA_256_LEN 32
 
+#define FIT_HASH_NODENAME "hash"
+
 /* Usage related data. */
 static const char usage_synopsis[] = "fdtextract [options] <file>";
 static const char usage_short_opts[] = "le:o:s:a:" USAGE_COMMON_SHORT_OPTS;
@@ -172,22 +174,33 @@ static int get_hash(char *buf, char *name)
 	const char *algo;
 
 	/* Get path of image hash node. */
-	snprintf(path, MAX_PATH_LEN, "/images/%s/hash-1", name);
+	snprintf(path, MAX_PATH_LEN, "/images/%s", name);
 	noffset = fdt_path_offset(buf, path);
 	if (noffset < 0) {
-		fprintf(stderr, "Error: could not find image hash: %s.\n", name);
+		fprintf(stderr, "Error: could not find image: %s.\n", name);
 		return -1;
 	}
 
-	/* Verify that we know the hash algo. */
-	algo = fdt_getprop(buf, noffset, "algo", NULL);
-	if (strcmp(algo, "sha256")) {
-		fprintf(stderr, "Error: unknown hash algorithm %s\n", val);
+	for (noffset = fdt_first_subnode(buf, noffset);
+	    noffset >= 0;
+	    noffset = fdt_next_subnode(buf, noffset)) {
+		/* Check subnode name, must start with "hash" */
+		const char *node_name = fdt_get_name(buf, noffset, NULL);
+		if (!strncmp(node_name, FIT_HASH_NODENAME,
+				strlen(FIT_HASH_NODENAME))) {
+			/* Verify that we know the hash algo. */
+			algo = fdt_getprop(buf, noffset, "algo", NULL);
+			if (algo && !strcmp(algo, "sha256")) {
+				val = (uint8_t *)fdt_getprop(buf, noffset, "value", NULL);
+				break;
+			}
+		}
+	}
+	if (!val) {
+		fprintf(stderr, "Error: No suitable hash found for image %s.\n", name);
 		return -1;
 	}
-
 	/* Print the hash. */
-	val = (uint8_t *)fdt_getprop(buf, noffset, "value", NULL);
 	for (i=0; i<SHA_256_LEN; i++)
 		printf("%02x", val[i]);
 	printf("\n");