zoukankan      html  css  js  c++  java
  • Saltstack module hashutil 详解

    hashutil.base64_b64encode

    Encode a string as base64 using the "modern" Python interface.
    
    Among other possible differences, the "modern" encoder does not include
    newline ('
    ') characters in the encoded output.
    
    New in version 2016.3.0
    
    CLI Example:
    
        salt '*' hashutil.base64_b64encode 'get salted'
    

    hashutil.digest_file

    Return a checksum digest for a file
    
    infile
        A file path
    checksum : ``md5``
        The hashing algorithm to use to generate checksums. Wraps the
        :py:func:`hashutil.digest <salt.modules.hashutil.digest>` execution
        function.
    
    CLI Example:
    
        salt '*' hashutil.digest_file /path/to/file
    

    hashutil.github_signature

    Verify a challenging hmac signature against a string / shared-secret for
    github webhooks.
    
    New in version 2017.7.0
    
    Returns a boolean if the verification succeeded or failed.
    
    CLI Example:
    
        salt '*' hashutil.github_signature '{"ref":....} ' 'shared secret' 'sha1=bc6550fc290acf5b42283fa8deaf55cea0f8c206'
    

    hashutil.base64_encodestring

    Encode a byte-like object as base64 using the "modern" Python interface.
    
    Among other possible differences, the "modern" encoder includes
    a newline ('
    ') character after every 76 characters and always
    at the end of the encoded byte-like object.
    
    New in version 3000
    
    CLI Example:
    
        salt '*' hashutil.base64_encodestring 'get salted'
    

    hashutil.sha256_digest

    Generate an sha256 hash of a given string
    
    New in version 2014.7.0
    
    CLI Example:
    
        salt '*' hashutil.sha256_digest 'get salted'
    

    hashutil.base64_decodestring

    Decode a base64-encoded byte-like object using the "modern" Python interface
    
    New in version 3000
    
    CLI Example:
    
        salt '*' hashutil.base64_decodestring instr='Z2V0IHNhbHRlZAo='
    

    hashutil.hmac_compute

    New in version 3000
    
    Compute a HMAC SHA256 digest using a string and secret.
    
    CLI Example:
    
        salt '*' hashutil.hmac_compute 'get salted' 'shared secret'
    

    hashutil.digest

    Return a checksum digest for a string
    
    instr
        A string
    checksum : ``md5``
        The hashing algorithm to use to generate checksums. Valid options: md5,
        sha256, sha512.
    
    CLI Example:
    
        salt '*' hashutil.digest 'get salted'
    

    hashutil.base64_encodefile

    Read a file from the file system and return as a base64 encoded string
    
    New in version 2016.3.0
    
    Pillar example:
    
        path:
          to:
            data: |
              {{ salt.hashutil.base64_encodefile('/path/to/binary_file') | indent(6) }}
    
    The :py:func:`file.decode <salt.states.file.decode>` state function can be
    used to decode this data and write it to disk.
    
    CLI Example:
    
        salt '*' hashutil.base64_encodefile /path/to/binary_file
    

    hashutil.md5_digest

    Generate an md5 hash of a given string
    
    New in version 2014.7.0
    
    CLI Example:
    
        salt '*' hashutil.md5_digest 'get salted'
    

    hashutil.hmac_signature

    Verify a challenging hmac signature against a string / shared-secret
    
    New in version 2014.7.0
    
    Returns a boolean if the verification succeeded or failed.
    
    CLI Example:
    
        salt '*' hashutil.hmac_signature 'get salted' 'shared secret' 'eBWf9bstXg+NiP5AOwppB5HMvZiYMPzEM9W5YMm/AmQ='
    

    hashutil.base64_b64decode

    Decode a base64-encoded string using the "modern" Python interface
    
    New in version 2016.3.0
    
    CLI Example:
    
        salt '*' hashutil.base64_b64decode 'Z2V0IHNhbHRlZA=='
    

    hashutil.base64_decodefile

    Decode a base64-encoded string and write the result to a file
    
    New in version 2016.3.0
    
    CLI Example:
    
        salt '*' hashutil.base64_decodefile instr='Z2V0IHNhbHRlZAo=' outfile='/path/to/binary_file'
    

    hashutil.sha512_digest

    Generate an sha512 hash of a given string
    
    New in version 2014.7.0
    
    CLI Example:
    
        salt '*' hashutil.sha512_digest 'get salted'
  • 相关阅读:
    中国年薪 ¥30 万和美国年薪$ 10 万的生活水平异同
    汽车之家CMDB设计思路 – 汽车之家运维团队博客
    平民软件 | 中间件
    FIT2CLOUD
    ZeroBrane Studio
    新炬网络-领先数据资产运营商 | 数据资产管理 | 数据库运维 | 自动化运维
    中国(南京)软件开发者大会
    夏仲璞 | 全球软件开发大会北京站2016
    Nginx下流量拦截算法 | 夏日小草
    docker~dockertoolbox的加速器
  • 原文地址:https://www.cnblogs.com/randomlee/p/Saltstack_module_hashutil.html
Copyright © 2011-2022 走看看