开发者

Checksum on string

开发者 https://www.devze.com 2023-03-31 13:58 出处:网络
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.

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消