You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "pkarashchenko (via GitHub)" <gi...@apache.org> on 2023/09/19 18:37:29 UTC

[GitHub] [nuttx-apps] pkarashchenko commented on a diff in pull request #2075: nshlib: Implementation of modifying command md5

pkarashchenko commented on code in PR #2075:
URL: https://github.com/apache/nuttx-apps/pull/2075#discussion_r1330550504


##########
nshlib/nsh_codeccmd.c:
##########
@@ -572,7 +495,29 @@ int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
 #ifdef HAVE_CODECS_HASH_MD5
 int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
 {
-  return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_HASH_MD5, md5_cb);
+  int i;
+  int ret = OK;
+  unsigned char digest[16];
+
+  if (argc == 3 && !strncmp(argv[1], "-f", 2))
+    {
+      ret = md5_file(argv[2], digest);
+      if (ret < 0)
+        {
+          return ret;
+        }
+    }
+  else
+    {
+      md5_sum((unsigned char *)argv[1], strlen(argv[1]), digest);

Review Comment:
   ```suggestion
         md5_sum((FAR unsigned char *)argv[1], strlen(argv[1]), digest);
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org