Crypt-RIPEMD160
view release on metacpan or search on metacpan
- Add binmode to addfile() for cross-platform consistency on Windows. PR #57
- Return $self from Perl-level add() and addfile() to enable method
chaining at the Perl layer (XS already returned $self). PR #54
- Zero MAC key material (key, k_ipad, k_opad) in DESTROY to reduce
the window for key material leaking into freed memory. PR #62
- Use dead-store-proof memset loop for zeroing sensitive memory so the
compiler cannot optimise away the wipe. PR #50
- Define PERL_NO_GET_CONTEXT in the XS file for correctness under
threaded Perl builds. PR #60
- Silence -Wall -Wextra compiler warnings in XS code. PR #49
- Include t/03streaming.t in MANIFEST so it is shipped in CPAN
distributions. PR #48
Improvements:
- Inherit from Digest::base to support the standard Perl Digest API:
b64digest, add_bits, and loading via Digest->new('RIPEMD-160'). PR #58
- Return $self from XS-level add() and reset() to allow method
chaining: $ctx->reset->add($data)->digest(). PR #53
- Delegate MAC addfile() to the inner RIPEMD-160 addfile() to avoid
duplicating the read loop and binmode handling. PR #64
Maintenance:
- Add proper =head2 method sections to MAC.pm POD. PR #51
- Add comprehensive MAC test suite covering HMAC correctness, reset,
addfile, and long-key hashing. PR #55
- Add streaming consistency tests verifying that single-call and
multi-call add() produce identical digests. PR #46
- Move X[] scratch buffer from the RIPEMD-160 state struct to the
stack, reducing per-context memory usage. PR #52
- Add #!include_default to MANIFEST.SKIP for robust exclusion of
build artefacts. PR #59
- Fix CI author-test failures on older Perls: install develop deps
and skip tests for methods unavailable before Digest::base
integration. PR #61
- Narrow .gitignore *.c pattern to only the XS-generated C file. PR #63
rmd160/hash/rmd160.c
rmd160/hash/rmd160.h
rmd160/mac/mactest.c
rmd160/mac/rmd128mc.c
rmd160/mac/rmd128mc.h
rmd160/mac/rmd160mc.c
rmd160/mac/rmd160mc.h
SECURITY.md
t/01test.t
t/02methods.t
t/03streaming.t
t/04mac.t
t/05digest_api.t
t/05encoding.t
t/06addfile_binmode.t
t/pod-coverage.t
t/pod.t
typemap
wrap_160.c
wrap_160.h
META.yml Module YAML meta-data (added by MakeMaker)
t/03streaming.t view on Meta::CPAN
$end = length($msg) if $end > length($msg);
$ctx->add(substr($msg, $offset, $end - $offset));
$offset = $end;
}
my $hex = unpack("H*", $ctx->digest);
is($hex, $expected, "56 bytes in chunks of $chunk_size");
}
};
# ========================================
# Multi-argument add() streaming
# ========================================
subtest 'multi-arg add matches sequential add' => sub {
my $msg = 'X' x 200;
my $expected = reference_hash($msg);
# Split into 7 pieces at irregular intervals
my @pieces = map { substr($msg, $_ * 29, 29) } 0..5;
push @pieces, substr($msg, 174); # remaining 26 bytes
t/03streaming.t view on Meta::CPAN
# Sequential add calls
my $ctx2 = Crypt::RIPEMD160->new;
$ctx2->add($_) for @pieces;
my $hex2 = unpack("H*", $ctx2->digest);
is($hex1, $expected, 'multi-arg add produces correct hash');
is($hex2, $expected, 'sequential add produces correct hash');
};
# ========================================
# MAC streaming consistency
# ========================================
subtest 'MAC streaming: same data different chunk sizes' => sub {
my $key = chr(0x0b) x 20;
my $data = "Hi There" x 10; # 80 bytes, crosses block boundary
# Reference: single add
my $mac_ref = Crypt::RIPEMD160::MAC->new($key);
$mac_ref->add($data);
my $expected = $mac_ref->hexmac;
# Byte-at-a-time
my $mac1 = Crypt::RIPEMD160::MAC->new($key);
( run in 0.877 second using v1.01-cache-2.11-cpan-140bd7fdf52 )