X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FFile%2FKDBX%2FConstants.pm;h=fe806242adefadae5090249e022c85bfa080e2a2;hb=37b09e0f2832514b33de4499a83f22d5ffe7c0a3;hp=ea4e02636d56900fee53f42e299f9fc964ea8db5;hpb=05e0bcef1c2165c556b910314312866dc4a667b7;p=chaz%2Fp5-File-KDBX diff --git a/lib/File/KDBX/Constants.pm b/lib/File/KDBX/Constants.pm index ea4e026..fe80624 100644 --- a/lib/File/KDBX/Constants.pm +++ b/lib/File/KDBX/Constants.pm @@ -274,8 +274,9 @@ BEGIN { } our %EXPORT_TAGS; -push @{$EXPORT_TAGS{header}}, 'KDBX_HEADER'; -push @{$EXPORT_TAGS{inner_header}}, 'KDBX_INNER_HEADER'; +push @{$EXPORT_TAGS{header}}, 'kdbx_header'; +push @{$EXPORT_TAGS{compression}}, 'compression'; +push @{$EXPORT_TAGS{inner_header}}, 'kdbx_inner_header'; push @{$EXPORT_TAGS{icon}}, 'icon'; $EXPORT_TAGS{all} = [map { @$_ } values %EXPORT_TAGS]; @@ -290,8 +291,13 @@ for my $header ( ) { $HEADER{$header} = $HEADER{0+$header} = $header; } -sub KDBX_HEADER { $HEADER{$_[0]} } +sub kdbx_header { $HEADER{$_[0]} } +my %COMPRESSION; +for my $compression (COMPRESSION_NONE, COMPRESSION_GZIP) { + $COMPRESSION{$compression} = $COMPRESSION{0+$compression} = $compression; +} +sub compression { $COMPRESSION{$_[0]} } my %INNER_HEADER; for my $inner_header ( @@ -300,7 +306,7 @@ for my $inner_header ( ) { $INNER_HEADER{$inner_header} = $INNER_HEADER{0+$inner_header} = $inner_header; } -sub KDBX_INNER_HEADER { $INNER_HEADER{$_[0]} } +sub kdbx_inner_header { $INNER_HEADER{$_[0]} } my %ICON; for my $icon ( @@ -399,7 +405,13 @@ Constants related to parsing and generating KDBX file headers: = C = C = C -= C + +=func kdbx_header + + $constant = kdbx_header($number); + $constant = kdbx_header($string); + +Get a header constant from an integer or string value. =head2 :compression @@ -409,6 +421,13 @@ Constants related to identifying the compression state of a file: = C = C +=func compression + + $constant = compression($number); + $constant = compression($string); + +Get a compression constant from an integer or string value. + =head2 :cipher Constants related ciphers: @@ -484,7 +503,13 @@ Constants related to parsing and generating KDBX4 inner headers: = C = C = C -= C + +=func kdbx_inner_header + + $constant = kdbx_inner_header($number); + $constant = kdbx_inner_header($string); + +Get an inner header constant from an integer or string value. =head2 :key_file @@ -579,6 +604,13 @@ Constants for default icons used by KeePass password safe implementations: = C = C +=func icon + + $constant = icon($number); + $constant = icon($string); + +Get an icon constant from an integer or string value. + =head2 :bool Boolean values: