From bf37295faeb9535c56671f4b2050260e1b88cd32 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 15 Jan 2019 15:53:31 -0800 Subject: Updating to v6.15, which includes "external (...)" instead of separate 'externally' versions of stuff, and some auto-formatting. --- lib/file_hash/init.nom | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'lib/file_hash') 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)) -- cgit v1.2.3