加密

作者: 歌哥居士 | 来源:发表于2019-03-28 08:44 被阅读0次

    Mac

    SHA

    -a: 选择算法,1 (默认), 224, 256, 384, 512, 512224, 512256

    加密文件:shasum -a [加密算法] 文件路径
    $ shasum -a 512 ~/Downloads/filebeat-6.3.2-darwin-x86_64.tar.gz
    129c09069550db0798bafb1cfd82d5f6da2cf0161ca48d3e6a81400889b2f295f18c7a41234b7adafa71eedb5c01f18f5b9e8600e11230676574d1fb587181ef  /Users/baozi/Downloads/filebeat-6.3.2-darwin-x86_64.tar.gz
    

    MD5

    加密文件:md5 文件路径
    $ md5 ~/Downloads/filebeat-6.3.2-darwin-x86_64.tar.gz
    MD5 (/Users/baozi/Downloads/filebeat-6.3.2-darwin-x86_64.tar.gz) = d9ab2a0a0a1279b6f3e4d703db55105b
    
    加密字符串:md5 -s "字符串"
    $ md5 -s "Baozi"
    MD5 ("Baozi") = 052e5780910c5ce450972ebafbb64475
    

    Java

    Apache commons-codec

    // c566b3f8e7afa8712a0426752951099ae0cd92474a7e6faa2e184a75f5fc885c4fe16222b22971c9e77d0ee5a7a6f435cd367a7189eb3f09bcbb077ddc8ed918
    DigestUtils.sha512Hex("Baozi");
    // c566b3f8e7afa8712a0426752951099ae0cd92474a7e6faa2e184a75f5fc885c4fe16222b22971c9e77d0ee5a7a6f435cd367a7189eb3f09bcbb077ddc8ed918
    DigestUtils.sha512Hex("Baozi".getBytes());
    // 129c09069550db0798bafb1cfd82d5f6da2cf0161ca48d3e6a81400889b2f295f18c7a41234b7adafa71eedb5c01f18f5b9e8600e11230676574d1fb587181ef
    DigestUtils.sha512Hex(new FileInputStream("/Users/baozi/Downloads/filebeat-6.3.2-darwin-x86_64.tar.gz"));
    

    相关文章

      网友评论

          本文标题:加密

          本文链接:https://www.haomeiwen.com/subject/rpnnvqtx.html