Movatterモバイル変換


[0]ホーム

URL:


CFEngine documentation homepage

hashmatch

Suggest changes
Table of contents

Prototype:hashmatch(filename, algorithm, hash)

Return type:boolean

Description: Compute the hash of filefilename using the hashalgorithm and test if it matcheshash.

This function may be used to determine whether a system has a particularversion of a binary file (e.g. software patch).

Arguments:

  • filename:string - Filename to hash - in the range:"?(/.*)
  • algorithm: - Hash or digest algorithm - one of
    • md5
    • sha1
    • sha256
    • sha384
    • sha512
  • hash:string - ASCII representation of hash for comparison - in the range:[a-zA-Z0-9_$(){}\[\].:]+

hash is an ASCII representation of the hash for comparison.

Example:

code
bundleagentexample{classes:"matches"expression=>hashmatch("/etc/passwd","md5","c5068b7c2b1707f8939b283a2758a691");reports:matches::"File has correct version";}

Still need help?

Chat Ask a question on Github Mailing list
Version 
master3.24 (LTS)3.21 (LTS)view all versions

[8]ページ先頭

©2009-2025 Movatter.jp