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 134     134   697 use strict;
  134         201  
  134         3598  
4 134     134   492 use warnings ;
  134         187  
  134         8643  
5             our $VERSION = '0.088';
6              
7             require XSLoader;
8             XSLoader::load('CryptX', $VERSION);
9              
10 134     134   613 use Carp;
  134         162  
  134         10718  
11             my $has_json;
12              
13             BEGIN {
14 134 50   134   332 $has_json = 1 if eval { require JSON; 1 };
  134         42056  
  0         0  
15             }
16              
17             sub _croak {
18 36 50 33 36   152 die @_ if ref $_[0] || !$_[-1];
19 36 50       215 if ($_[-1] =~ /^(.*)( at .+ line .+\n$)/s) {
20 36         47 pop @_;
21 36         95 push @_, $1;
22             }
23 36         4088 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, HKDF, Bcrypt, Scrypt, Argon2
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