diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2019-01-15 15:53:31 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2019-01-15 15:54:28 -0800 |
| commit | bf37295faeb9535c56671f4b2050260e1b88cd32 (patch) | |
| tree | d544b68bca8c5bdf0926cc20a12f925c1761cfda /lib/file_hash | |
| parent | ef70abe4b7ed8d04574ab24ea4fd74fe2a64221f (diff) | |
Updating to v6.15, which includes "external (...)" instead of separate
'externally' versions of stuff, and some auto-formatting.
Diffstat (limited to 'lib/file_hash')
| -rw-r--r-- | lib/file_hash/init.nom | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/lib/file_hash/init.nom b/lib/file_hash/init.nom index 7b428cd..709c622 100644 --- a/lib/file_hash/init.nom +++ b/lib/file_hash/init.nom @@ -1,4 +1,4 @@ -#!/usr/bin/env nomsu -V6.14 +#!/usr/bin/env nomsu -V6.15.13.8 # This file defines some actions for hashing files and looking up files by hash. @@ -32,9 +32,10 @@ test: assume ((hash "hello world") == "Kq5sNclPz7QV2+lfQIuc6R7oRu0=") if $use_sha1: - externally (hash $) means: - $hash = (=lua "\$hashlib.new('sha1'):final(\$)") - return (base64 $hash) + external: + (hash $) means: + $hash = (=lua "\$hashlib.new('sha1'):final(\$)") + return (base64 $hash) ..else: # TODO: remove warning? say (" @@ -42,19 +43,20 @@ if $use_sha1: ..hash function.\027[0m ") - externally (hash $) means: - $bytes = ($, bytes) - $hash = ($bytes.1 << 7) - for $i in 2 to (size of $bytes): - $hash = ((1000003 * $hash) ~ $bytes.$i) - $hash = ($hash ~ (size of $bytes)) - return "\$hash" + external: + (hash $) means: + $bytes = ($, bytes) + $hash = ($bytes.1 << 7) + for $i in 2 to (size of $bytes): + $hash = ((1000003 * $hash) ~ $bytes.$i) + $hash = ($hash ~ (size of $bytes)) + return "\$hash" -externally (file with hash $hash) means: - for $filename in (files for "."): - $contents = (read file $filename) - $file_hash = (hash $contents) - if ($file_hash == $hash): - return $filename - -(hash of file $filename) parses as (hash (read file $filename)) +external: + (file with hash $hash) means: + for $filename in (files for "."): + $contents = (read file $filename) + $file_hash = (hash $contents) + if ($file_hash == $hash): + return $filename + (hash of file $filename) parses as (hash (read file $filename)) |
