1#!/usr/bin/env perl
2
3##
4## Author......: See docs/credits.txt
5## License.....: MIT
6##
7
8use strict;
9use warnings;
10
11use Digest::SHA qw (sha224_hex);
12
13sub module_constraints { [[0, 256], [-1, -1], [0, 55], [-1, -1], [-1, -1]] }
14
15sub module_generate_hash
16{
17  my $word = shift;
18
19  my $digest = sha224_hex ($word);
20
21  my $hash = sprintf ("%s", $digest);
22
23  return $hash;
24}
25
26sub module_verify_hash
27{
28  my $line = shift;
29
30  my ($hash, $word) = split (':', $line);
31
32  return unless defined $hash;
33  return unless defined $word;
34
35  my $word_packed = pack_if_HEX_notation ($word);
36
37  my $new_hash = module_generate_hash ($word_packed);
38
39  return ($new_hash, $word);
40}
41
421;
43