Commit | Line | Data |
---|---|---|
096619f2 MG |
1 | package Digest::HighwayHash; |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | use parent qw/Exporter/; | |
7 | ||
8 | our @EXPORT_OK = qw/highway_hash64 highway_hash128 highway_hash256/; | |
9 | our @EXPORT = @EXPORT_OK; | |
10 | ||
5c859103 | 11 | our $VERSION = '0.001001'; |
096619f2 MG |
12 | |
13 | use Math::Int64; | |
14 | ||
15 | require XSLoader; | |
16 | XSLoader::load('Digest::HighwayHash', $VERSION); | |
17 | ||
18 | 1; | |
19 | __END__ | |
20 | ||
21 | =encoding utf-8 | |
22 | ||
23 | =head1 NAME | |
24 | ||
fc185944 | 25 | Digest::HighwayHash - XS fast strong keyed hash function |
096619f2 MG |
26 | |
27 | =head1 SYNOPSIS | |
28 | ||
29 | use Digest::HighwayHash; | |
30 | say highway_hash64 [1, 2, 3, 4], 'hello'; | |
31 | # 11956820856122239241 | |
32 | say join ' ', @{highway_hash128([1, 2, 3, 4], 'hello')}; | |
33 | # 3048112761216189476 13900443277579286659 | |
34 | say join ' ', @{highway_hash256([1, 2, 3, 4], 'hello')}; | |
35 | # 8099666330974151427 17027479935588128037 4015249936799013189 10027181291351549853 | |
36 | ||
37 | =head1 DESCRIPTION | |
38 | ||
fc185944 | 39 | HighwayHash is a fast and strong keyed hash function, documented at |
096619f2 MG |
40 | L<https://github.com/google/highwayhash>. |
41 | ||
fc185944 MG |
42 | Three functions are exported by this module, all by default: |
43 | ||
44 | =over | |
45 | ||
46 | =item B<highway_hash64> I<\@key>, I<$input> | |
47 | ||
48 | Compute the 64-bit HighwayHash of I<$input>, using I<\@key> as a key. | |
49 | The key must be a 4-element arrayref, with each element either a | |
50 | number or (on Perls without 64-bit numbers) a L<Math::Int64> object. The result is a single number or (on Perls without 64-bit numbers) a L<Math::Int64> object. | |
51 | ||
52 | =item B<highway_hash128> I<\@key>, I<$input> | |
53 | ||
54 | Compute the 128-bit HighwayHash of I<$input>, using I<\@key> as a key. | |
55 | The key must be a 4-element arrayref, with each element either a | |
56 | number or (on Perls without 64-bit numbers) a L<Math::Int64> object. The result is an array of exactly two numbers or (on Perls without 64-bit numbers) L<Math::Int64> objects. | |
57 | ||
58 | =item B<highway_hash256> I<\@key>, I<$input> | |
59 | ||
60 | Compute the 256-bit HighwayHash of I<$input>, using I<\@key> as a key. | |
61 | The key must be a 4-element arrayref, with each element either a | |
62 | number or (on Perls without 64-bit numbers) a L<Math::Int64> object. The result is an array of exactly four numbers or (on Perls without 64-bit numbers) L<Math::Int64> objects. | |
63 | ||
64 | ||
65 | =back | |
66 | ||
096619f2 MG |
67 | =head1 SEE ALSO |
68 | ||
69 | L<https://github.com/google/highwayhash> | |
70 | ||
71 | =head1 AUTHOR | |
72 | ||
73 | Marius Gavrilescu, E<lt>marius@ieval.roE<gt> | |
74 | ||
75 | =head1 COPYRIGHT AND LICENSE | |
76 | ||
77 | Copyright (C) 2018 by Marius Gavrilescu | |
78 | ||
79 | This library is free software; you can redistribute it and/or modify | |
80 | it under the same terms as Perl itself, either Perl version 5.24.1 or, | |
81 | at your option, any later version of Perl 5 you may have available. | |
82 | ||
83 | ||
84 | =cut |