Preface by saying by no stretch do I pretend to be a programmer, just make short scripts and utils for personal use.
Only recently delved into Ruby and made a couple of maintenance scripts, but I can’t seem to wrap starkits like I can with Python or TCL, so was excited to find Crystal. I found one roadblock in a script I was converting; the script calls this block many times during its run:
def do_file_digest(file_in)
return (Digest::SHA512.file file_in).to_s
end
There seems to be a file method in Crystal as far as I can tell, but I can’t seem to implement it correctly.
For what it’s worth, the other call to digest in my Ruby script hashes strings:
var = Digest::SHA512.hexdigest <string>
and it works fine in Crystal. Hopefully someone can point me in the right direction with regard to implementing .file, thanks.