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::MD4 qw (md4_hex);
12use Text::Iconv;
13
14sub module_constraints { [[0, 256], [-1, -1], [0, 27], [-1, -1], [-1, -1]] }
15
16sub module_generate_hash
17{
18  my $word = shift;
19
20  my $converter = Text::Iconv->new('utf8', 'UTF-16LE');
21
22  my $digest = md4_hex ($converter->convert ($word));
23
24  return $digest;
25}
26
27sub module_verify_hash
28{
29  my $line = shift;
30
31  my ($hash, $word) = split (':', $line);
32
33  return unless defined $hash;
34  return unless defined $word;
35
36  my $word_packed = pack_if_HEX_notation ($word);
37
38  my $new_hash = module_generate_hash ($word_packed);
39
40  return ($new_hash, $word);
41}
42
431;
44