commandbox.system.modules_app.system-commands.commands

Class checksum

lucee.Component
    extended by commandbox.system.modules_app.system-commands.commands.checksum

Generate checksum for a file or a directory via a globbing pattern. Default is MD5, but SHA-1, SHA-256, and SHA-512 can also be used. . {code:bash} checksum file.txt checksum build.zip SHA-256 {code} Create a checksum for more than one file in a directory with a file globbing pattern . {code:bash} checksum path=*.zip {code} Write checksum(s) to a file named after the original file plus a new extension. This will create a file called "myFile.zip.md5". . {code:bash} checksum myFile.zip md5 --write {code} Control the file extension like so. (--write is optional when supplying an extension) This will create a file called "myFile.zip.hash". . {code:bash} checksum path=myFile.zip extension=hash --write {code} Control the format of the hash with the "format" parameter. {code:bash} - "checksum" (default) -- just the hash - "md5sum" -- The format of GNU textutils md5sum - "sfv" -- The format of BSDs md5 command {code} Verify a file against an existing hash. Error will be thrown if checksums are different . {code:bash} checksum path=myFile.zip verify=2A95F32028087699CCBEB09AFDA0348C {code}

Class Attributes:
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
    Method Summary
    any algorithmComplete()
    any formatComplete()
    any run(commandbox.system.modules_app.system-commands.commands.Globber path, [String algorithm='md5'], [String extension], [String format='checksum'], [String verify=''], [Boolean write='false'])
     
    Methods inherited from class lucee.Component
    None

    Method Detail

    algorithmComplete

    public any algorithmComplete()


    formatComplete

    public any formatComplete()


    run

    public any run(commandbox.system.modules_app.system-commands.commands.Globber path, [String algorithm='md5'], [String extension], [String format='checksum'], [String verify=''], [Boolean write='false'])

    Parameters:
    path - Path of file or globbing pattern to create checksum of
    algorithm - Hashing algorithm to use
    extension - File extension to write. Using this sets write to true.
    format - Format to write hash in. checksum, md5sum, or sfv
    verify - A hash to verify to a file. Error will be thrown if checksums don't match.
    write - Write checksum to a file instead of outputting to console