NAME

Rex::Rancher::Checksum - SHA-256 checks of downloaded release artifacts

VERSION

version 0.003

SYNOPSIS

use Rex::Rancher::Checksum;

my $C = 'Rex::Rancher::Checksum';
$C->verify_sha256(
  scalar $C->expected_sha256($sums_text, 'rke2.linux-amd64.tar.gz'),
  scalar $C->sha256_of($sha256sum_output),
  'rke2.linux-amd64.tar.gz',
);

DESCRIPTION

Pure parsing and comparison of SHA-256 checksums, the same for RKE2 and K3s: the official sha256sum-ARCH.txt of a release against the sha256sum output for the downloaded file. Nothing here reads the host; the commands that produce both texts run in "fetch_artifacts" in Rex::Rancher::Distribution. Class methods; nothing is exported. The same methods are still callable on Rex::Rancher::Distribution, which hands them on to this class.

expected_sha256

Rex::Rancher::Checksum->expected_sha256($sums_text, $asset)

The checksum for exactly $asset in an official sha256sum-ARCH.txt, or nothing. Exact name match: k3s does not pick up k3s-airgap-images-....

sha256_of

The first field of sha256sum FILE output, or nothing.

verify_sha256

Rex::Rancher::Checksum->verify_sha256($expected, $actual, $asset)

Returns 1 when both are there and equal, dies otherwise.

SEE ALSO

Rex::Rancher::Distribution

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/rex-rancher/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.