X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FFile%2FKDBX%2FConstants.pm;h=e5f5f1d0c7b7670c1338072619c0ef0850cc5906;hb=99dbb5c5175265d05f9019a15a3b67877408256f;hp=6eea0ef01cfb2f80bc877cc3a4ba5aa329bb3fac;hpb=4dc2a1996dfcf2dfda3c554daa2f5f59fa763494;p=chaz%2Fp5-File-KDBX diff --git a/lib/File/KDBX/Constants.pm b/lib/File/KDBX/Constants.pm index 6eea0ef..e5f5f1d 100644 --- a/lib/File/KDBX/Constants.pm +++ b/lib/File/KDBX/Constants.pm @@ -6,10 +6,12 @@ package File::KDBX::Constants; # 2. List it in the pod at the bottom of this file in the section corresponding to its tag. # 3. There is no step three. +use 5.010; use warnings; use strict; use Exporter qw(import); +use File::KDBX::Util qw(int64); use Scalar::Util qw(dualvar); use namespace::clean -except => 'import'; @@ -126,8 +128,14 @@ BEGIN { }, history => { __prefix => 'HISTORY', + DEFAULT_MAX_AGE => 365, DEFAULT_MAX_ITEMS => 10, - DEFAULT_MAX_SIZE => 6_291_456, # 6 M + DEFAULT_MAX_SIZE => 6_291_456, # 6 MiB + }, + iteration => { + ITERATION_BFS => dualvar(1, 'bfs'), + ITERATION_DFS => dualvar(2, 'dfs'), + ITERATION_IDS => dualvar(3, 'ids'), }, icon => { __prefix => 'ICON', @@ -207,7 +215,7 @@ BEGIN { }, time => { __prefix => 'TIME', - SECONDS_AD1_TO_UNIX_EPOCH => 62_135_596_800, + SECONDS_AD1_TO_UNIX_EPOCH => int64('62135596800'), }, yubikey => { YUBICO_VID => dualvar( 0x1050, 'Yubico'), @@ -291,13 +299,13 @@ for my $header ( ) { $HEADER{$header} = $HEADER{0+$header} = $header; } -sub to_header_constant { $HEADER{$_[0]} } +sub to_header_constant { $HEADER{$_[0] // ''} } my %COMPRESSION; for my $compression (COMPRESSION_NONE, COMPRESSION_GZIP) { $COMPRESSION{$compression} = $COMPRESSION{0+$compression} = $compression; } -sub to_compression_constant { $COMPRESSION{$_[0]} } +sub to_compression_constant { $COMPRESSION{$_[0] // ''} } my %INNER_HEADER; for my $inner_header ( @@ -306,7 +314,7 @@ for my $inner_header ( ) { $INNER_HEADER{$inner_header} = $INNER_HEADER{0+$inner_header} = $inner_header; } -sub to_inner_header_constant { $INNER_HEADER{$_[0]} } +sub to_inner_header_constant { $INNER_HEADER{$_[0] // ''} } my %ICON; for my $icon ( @@ -430,7 +438,7 @@ Get a compression constant from an integer or string value. =head2 :cipher -Constants related ciphers: +Constants related to ciphers: =for :list = C @@ -526,9 +534,19 @@ Constants related to identifying key file types: Constants for history-related default values: =for :list += C = C = C +=head2 :iteration + +Constants for searching algorithms. + +=for :list += C - Iterative deepening search += C - Breadth-first search += C - Depth-first search + =head2 :icon Constants for default icons used by KeePass password safe implementations: