Generating a SHA-256 hash from the Linux command line

前端 未结 7 1497
孤城傲影
孤城傲影 2020-12-07 07:37

I know the string \"foobar\" generates the SHA-256 hash c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2 using http://hash.online-convert.com/sh

7条回答
  •  猫巷女王i
    2020-12-07 08:10

    For the sha256 hash in base64, use:

    echo -n foo | openssl dgst -binary -sha1 | openssl base64
    

    Example

    echo -n foo | openssl dgst -binary -sha1 | openssl base64
    C+7Hteo/D9vJXQ3UfzxbwnXaijM=
    

提交回复
热议问题