aboutsummaryrefslogtreecommitdiff
path: root/lib/file_hash.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-10-30 23:42:04 -0700
committerBruce Hill <bruce@bruce-hill.com>2018-10-30 23:42:36 -0700
commitea3197aaffba00318920ed5e1e33ca5f2a5e6c5c (patch)
tree2ec4aff13c7a54a3730994525b591ac60528b5ad /lib/file_hash.nom
parente7e84c9eda38c930f5475301de4a449dcf59e8b6 (diff)
Fully working version of (action [foo]: baz) -> ((foo) means: baz)
refactor and misc other changes.
Diffstat (limited to 'lib/file_hash.nom')
-rw-r--r--lib/file_hash.nom10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/file_hash.nom b/lib/file_hash.nom
index 6fdb2f4..6c815f5 100644
--- a/lib/file_hash.nom
+++ b/lib/file_hash.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V4.8.8.6
+#!/usr/bin/env nomsu -V4.8.10
#
This file defines some actions for hashing files and looking up files by hash.
@@ -26,14 +26,14 @@ test:
if %use_sha1:
assume ((hash "hello world") == "Kq5sNclPz7QV2+lfQIuc6R7oRu0=")
if %use_sha1:
- action [hash %]:
+ externally (hash %) means:
%hash = (=lua "\%hashlib.new('sha1'):final(\%)")
return (base64 %hash)
..else:
# TODO: remove warning?
say "\
..\027[31;1mWARNING: OpenSSL module not found. Defaulting to a non-cryptographically secure hash function.\027[0m"
- action [hash %]:
+ externally (hash %) means:
%bytes = (%::bytes)
%hash = (%bytes.1 << 7)
for %i in 2 to (size of %bytes):
@@ -41,10 +41,10 @@ if %use_sha1:
%hash = (%hash ~ (size of %bytes))
return "\%hash"
-action [file with hash %hash]:
+externally (file with hash %hash) means:
for file %filename in ".":
%contents = (read file %filename)
%file_hash = (hash %contents)
if (%file_hash == %hash): return %filename
-parse [hash of file %filename] as (hash (read file %filename))
+(hash of file %filename) parses as (hash (read file %filename))