IBM AIX: Calculate the SHA256 hashes of a directory without sha256sum

echo '#! /usr/bin/ksh\necho `cat $1 | openssl dgst -sha256` $1' > sslsha256; chmod +x sslsha256; find directory -type f -exec ./sslsha256 \{\} \;
This command is for producing GNU sha256sum-compatible hashes on UNIX systems that don't have sha256sum but do have OpenSSL, such as stock IBM AIX. 1.- Saves a wrapper script for UNIX find that does the following: A.- Feeds a file to openssl on SHA256 hash calculation mode B.- Echoes the output followed by the filename 2.- Makes the file executable 3.- Runs find on a directory, only processing files, and running on each one the wrapper script that calculates SHA256 hashes Pending is figuring out how to verify a sha256sum file on a similar environment.
Sample Output
6e94b0b7fc2805ad558f8039ed038a6272f61846eaa5f4931abd826193c78b83 cognos-installers/TM1-952-AIX/952_FP2_aix.tar.gz
c9d0f04ad6f86482bf4c41ba7a303e0d8a0e8c96c9c9492bc518d2a2bc0166c7 cognos-installers/TM1-952-AIX/952_FP2_HF6_aix.tar.gz
46ede3255abff4e356b002a9cd12df259275a15910768997bfbbae3c637b7f32 cognos-installers/TM1-952-windows/TM1_9.5.2_Windows_x64.7z
92faf20dd3ff25d2c8d94308f03fd8477d0980d6b740baa96a8e79b30b49456f cognos-installers/TM1-952-windows/TM1_Workflow_9.5.2_Windows_x64.7z
630a66a1f7cc3044f370cec730820d73d66cb284a2a09e197c00f82d6900d932 cognos-installers/cognos-BI-102/cognos-FM/fm_10.2_win_ml.tar.xz

2013-09-18 17:37:50

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: