As for MacOS to generate a SHA-256 hash for the string?

You need to generate a SHA-256 hash for a string variable from AppleScript. How to do it better?
October 8th 19 at 00:09
2 answers
October 8th 19 at 00:11
The sha1 command is shorthand for<br> <br / > cksum -a sha1<br> <br / > The cksum(1) command can also be used to compute digests from the SHA-2<br> family: sha256, sha384 and sha512.
This command only works on files - Tyrese.Schowalter commented on October 8th 19 at 00:14
In UNIX everything is a file.

echo-n "$VARIABLE" | cksum -a sha1 - denis9 commented on October 8th 19 at 00:17
October 8th 19 at 00:13
Here is the line for SHA-256:
echo-n "some string" | shasum -a 256

Find more questions by tags AppleScriptHashingmacOS