Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hArgs = {...}
- local function usage()
- printError("hasher <string> [file to output]")
- end
- if not SHA1 then
- if not os.loadAPI("/api/SHA1") then
- error("could not load hashing algorithm (SHA1)")
- end
- end
- if #hArgs < 1 then
- usage()
- else
- local texta = SHA1.digestStr(hArgs[1])
- print("Address: "..texta[1])
- local textb = textutils.serialize(SHA1.digestStr(hArgs[1]))
- print("SHA1 serialized bytehash: "..textb)
- if #hArgs == 2 then
- print("Outputting hash to "..hArgs[2])
- local file = fs.open(hArgs[2], "w")
- file.writeLine(texta)
- file.writeLine(textb)
- file.close()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment