https://github.com/cosimo/perl6-digest-md5
Perl6 port of Perl5' Digest::MD5 module
https://github.com/cosimo/perl6-digest-md5
Last synced: about 1 year ago
JSON representation
Perl6 port of Perl5' Digest::MD5 module
- Host: GitHub
- URL: https://github.com/cosimo/perl6-digest-md5
- Owner: cosimo
- Created: 2010-06-10T20:26:37.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2020-05-27T11:15:01.000Z (about 6 years ago)
- Last Synced: 2025-04-09T21:50:00.127Z (about 1 year ago)
- Language: Perl6
- Homepage:
- Size: 24.4 KB
- Stars: 11
- Watchers: 4
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Perl6 Digest::MD5 module
An interface-compatible port of
[Perl 5 Digest::MD5](https://metacpan.org/pod/Digest::MD5) to Perl 6.
Cosimo Streppone (cosimo@cpan.org)
### Synopsis
```perl6
use Digest::MD5;
say Digest::MD5.new.md5_hex("My awesome data to hash");
```
### Methods
#### `new`
```perl6
my $d = Digest::MD5.new;
```
Returns a new `Digest::MD5` object.
#### `md5_hex`
```perl6
my $md5_hash = $d.md5_hex('data');
my @data = "one", "two", "and more";
my $md5_hash = $d.md5_hex( @data );
# returns string '009ef1defa9fa27032f9f52cdeda8698'
```
Takes either a string or an array as the argument and returns MD5 hash
as a hex string.
#### `md5_buf`
```perl6
my $md5_buf = $d.md5_buf('data');
# returns Buf:0x<8d 77 7f 38 5d 3d fe c8 81 5d 20 f7 49 60 26 dc>
```
Takes same arguments as `md5_hex`, except returns a
[Buf](http://docs.perl6.org/type/Buf) instead of a string.
### Subroutines
### `Digest::MD5::md5`
```perl6
my $data = $str.encode('ascii');
my $md5_buf = Digest::MD5::md5($data);
# returns Buf:0x<8d 77 7f 38 5d 3d fe c8 81 5d 20 f7 49 60 26 dc>
```
Takes a buffer or array as an argument. Returns a [Buf](http://docs.perl6.org/type/Buf).
### Repository
http://github.com/cosimo/perl6-digest-md5
### Current status (2012-01-31)
Should work with latest (2012.01) release
of Rakudo, the "nom" branch-based version.