Checksum on string
Is there a way to calculate a checksum on a string in Linux? The checksum commands that I have seen (cksum
, md5sum
, sha1sum
, 开发者_JAVA百科etc.) all require a file as input and I do not have a file. I only have a path to a location and want to calculate the checksum on that path.
echo -n 'exampleString' | md5sum
should work.
echo -n "yourstring" |md5sum
echo -n "yourstring" |sha1sum
echo -n "yourstring" |sha256sum
don't forget -n or the result will change (cuz the newline will be parsed)
精彩评论