checksum

package
v0.0.0-...-5b41359 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

README

ChecksumPlugin

Computes file checksums (MD5 or SHA256).

Type

ProcessPlugin

Version

1.0

Name

checksum

Parameters

Parameter Required Source Description
file_path Yes Request Path to file to hash
algorithm No PluginCall Hash algorithm: md5 or sha256 (default: md5)

Note: algorithm is read at plugin initialization time from PluginCall.Params. If not specified, defaults to md5.

Output

{
  "hash": "<hex-encoded-hash>"
}

Usage Example

# Compute MD5 checksum (default)
- name: checksum
  parameters:
    file_path: "/path/to/file.txt"

# Compute SHA256 checksum (algorithm via PluginCall params)
- name: checksum
  parameters:
    file_path: "/path/to/file.txt"
  with:
    algorithm: "sha256"

Output Example

{
  "hash": "d41d8cd98f00b204e9800998ecf8427e"
}

Notes

  • Returns a 32-character hex string for MD5
  • Returns a 64-character hex string for SHA256

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PluginSpec = types.PluginSpec{
	Name:    pluginName,
	Version: pluginVersion,
	Type:    types.TypeProcess,
	InitParameters: []types.ParameterSpec{
		{
			Name:        "algorithm",
			Required:    false,
			Default:     "md5",
			Description: "Hash algorithm: md5, sha256",
			Options:     []string{"md5", "sha256"},
		},
	},
	Parameters: []types.ParameterSpec{
		{
			Name:        "file_path",
			Required:    true,
			Description: "Path to file",
		},
	},
}

Functions

func NewChecksumPlugin

func NewChecksumPlugin(ps types.PluginCall) types.Plugin

Types

type ChecksumPlugin

type ChecksumPlugin struct {
	// contains filtered or unexported fields
}

func (*ChecksumPlugin) Name

func (p *ChecksumPlugin) Name() string

func (*ChecksumPlugin) Run

func (p *ChecksumPlugin) Run(ctx context.Context, request *api.Request) (*api.Response, error)

func (*ChecksumPlugin) Type

func (p *ChecksumPlugin) Type() types.PluginType

func (*ChecksumPlugin) Version

func (p *ChecksumPlugin) Version() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL