shithub: tarsum

Download patch

ref: 01c1c0c7779125f8a83f75ecb277f0d63ead9200
parent: 059f9a658d20e467bba3f42e574ed381ef0c99d7
author: B. Atticus Grobe <grobe0ba@gmail.com>
date: Fri Dec 17 22:29:15 EST 2021

slightly nicer

--- a/tarsum
+++ b/tarsum
@@ -26,7 +26,7 @@
 
 local headertbl = {}
 for i = 1, #header, 1 do
-    table.insert(headertbl, string.sub(header, i, i))
+    headertbl:insert(header:sub(i, i))
 end
 
 for i = 0x94, 0x9b, 1 do
@@ -40,7 +40,7 @@
 
 local sum = 0
 for i = 1, #header, 1 do
-    sum = sum + string.byte(header,i)
+    sum = sum + header:byte(i)
 end
 
 print(string.format("Checksum: %.7o\n", sum))