octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pkg netlist


From: John W. Eaton
Subject: Re: pkg netlist
Date: Mon, 5 Mar 2007 17:24:34 -0500

On  5-Mar-2007, David Bateman wrote:

| Well MD5 only needs as little as 64bytes of a file in memory at any
| time, so yes for very large files the above might swap whereas md5sum
| system function won't. It's fairly easy to process a file rather than a
| string, but as you say I'd not like md5sum choosing between a file or a
| string based on context. I don't really like an option either, but
| prefer it to two different function names. I'd therefore propose, a
| trailing option like in the attached patch, where the default is to
| treat the first argument as a filename (since thats what Bob prefers),
| and as a string if the second argument evaluates to true. Consider the
| attached patch. Given what you said above I applied it..

OK, thanks.

BTW, your example

  fid = fopen (file, "rb")
  buf = fread(fid)
  fclose(fid)
  md5 = md5sum(char(buf)')

would be more efficient if written this way:

  fid = fopen (file, "rb")
  buf = fread (fid, Inf, "char")
  fclose(fid)
  md5 = md5sum (buf)

as it avoids storing the data in a double precision array and then
converting to char.  Also, I don't see the need for the transpose on
buf.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]