]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_core/commitdiff
telnet-file: sha256 use hex for convenience; dox
authorNathaniel Wesley Filardo <nwfilardo@gmail.com>
Wed, 6 Feb 2019 00:52:38 +0000 (00:52 +0000)
committerNathaniel Wesley Filardo <nwfilardo@gmail.com>
Fri, 22 Feb 2019 23:55:08 +0000 (23:55 +0000)
telnetd/readme.rst
telnetd/telnetd-file.lua

index 38aa4410993c707655698bd290835f373bd343ee..84f534baf7ba93d30a52ef82da5a7363406cc395 100644 (file)
@@ -34,6 +34,8 @@ sending a response, is passed in to the function so retrieved.
   * ``pread`` is the read dual of ``pwrite``; takes a length, an offset, and
     a file name, and returns a base64-encoded blob.  Be careful that length
     is reasonable, to minimize heap usage.
+  * ``sha256`` reports the ASCII-fied hex of the file given, useful for
+    verification of flash contents.
   * ``cert`` loads a file in its entirety and passes it to ``net.cert.verify``.
     Be careful, as this can use a lot of heap.
 
index f7d4716cc0de60a258207bd51be3a7269d162d3c..12e9e3675633f9b9360c1d28ed3367e22c897ac4 100644 (file)
@@ -17,7 +17,7 @@ return {
   end
 , ["sha256"] = function(ll,s) -- compute the hash of a file in flash
     local fn = string.match(ll,"^%s*([^%s]+)%s*$")
-    s(crypto.toBase64(crypto.fhash('sha256',fn)))
+    s(crypto.tohex(crypto.fhash('sha256',fn)))
   end
 , ["pread"] = function(ll,s) -- read b64 data from off in fn
     local len, off, fn = string.match(ll,"^%s*(%d+)%s+(%d+)%s+([^%s]+)%s*$")