File Coverage

blib/lib/CryptX.pm
Criterion Covered Total %
statement 16 21 76.1
branch 3 10 30.0
condition 1 3 33.3
subroutine 5 7 71.4
pod n/a
total 25 41 60.9


line stmt bran cond sub pod time code
1             package CryptX;
2              
3 133     133   1096 use strict;
  133         341  
  133         5375  
4 133     133   718 use warnings ;
  133         276  
  133         13091  
5             our $VERSION = '0.087';
6              
7             require XSLoader;
8             XSLoader::load('CryptX', $VERSION);
9              
10 133     133   856 use Carp;
  133         284  
  133         15059  
11             my $has_json;
12              
13             BEGIN {
14 133 50   133   479 $has_json = 1 if eval { require JSON; 1 };
  133         61470  
  0         0  
15             }
16              
17             sub _croak {
18 38 50 33 38   220 die @_ if ref $_[0] || !$_[-1];
19 38 50       288 if ($_[-1] =~ /^(.*)( at .+ line .+\n$)/s) {
20 38         70 pop @_;
21 38         117 push @_, $1;
22             }
23 38         6321 die Carp::shortmess @_;
24             }
25              
26             sub _decode_json {
27 0 0   0     croak "FATAL: cannot find JSON module" if !$has_json;
28 0           return JSON->new->utf8->decode(shift);
29             }
30              
31             sub _encode_json {
32 0 0   0     croak "FATAL: cannot find JSON module" if !$has_json;
33 0           return JSON->new->utf8->canonical->encode(shift);
34             }
35              
36             1;
37              
38             =pod
39              
40             =head1 NAME
41              
42             CryptX - Cryptographic toolkit
43              
44             =head1 DESCRIPTION
45              
46             Perl modules providing a cryptography based on L library.
47              
48             =over
49              
50             =item * Symmetric ciphers - see L and related modules
51              
52             L, L, L, L, L, L,
53             L, L, L, L, L, L,
54             L, L, L, L, L, L,
55             L, L, L, L, L,
56             L, L
57              
58             =item * Block cipher modes
59              
60             L, L, L, L, L
61              
62             =item * Stream ciphers
63              
64             L, L, L, L,
65             L, L
66              
67             =item * Authenticated encryption modes
68              
69             L, L, L, L, L
70              
71             =item * Hash Functions - see L and related modules
72              
73             L, L, L, L,
74             L, L, L, L,
75             L, L, L, L, L, L,
76             L, L, L, L, L, L,
77             L, L, L, L, L,
78             L, L, L, L,
79             L, L, L, L, L
80              
81             =item * Checksums
82              
83             L, L
84              
85             =item * Message Authentication Codes
86              
87             L, L, L, L, L,
88             L, L, L, L
89              
90             =item * Public key cryptography
91              
92             L, L, L, L, L, L
93              
94             =item * Cryptographically secure random number generators - see L and related modules
95              
96             L, L, L, L, L
97              
98             =item * Key derivation functions - PBKDF1, PBKDF2 and HKDF
99              
100             L
101              
102             =item * Other handy functions related to cryptography
103              
104             L
105              
106             =back
107              
108             =head1 LICENSE
109              
110             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
111              
112             =head1 COPYRIGHT
113              
114             Copyright (c) 2013-2025 DCIT, a.s. L / Karel Miko
115              
116             =cut