App-Genpass-ID
view release on metacpan or search on metacpan
script/genpass-id view on Meta::CPAN
#!perl
### code_after_shebang
# Note: This script is a CLI for Riap function /App/Genpass/ID/genpass
# and generated automatically using Perinci::CmdLine::Gen version 0.483
# PERICMD_INLINE_SCRIPT: {"code_after_shebang":"...","config_dirs":null,"config_filename":"genpass-id.conf","env_name":"GENPASS_ID_OPT","include":null,"log":null,"pack_deps":1,"pod":0,"read_config":1,"read_env":1,"script_name":"genpass-id","script_su...
my $_pci_metas = {""=>{args=>{num=>{cmdline_aliases=>{n=>{}},default=>1,schema=>["int",{min=>1,req=>1},{}]},patterns=>{cmdline_aliases=>{p=>{}},default=>["%w %w %w","%w %w %w %w","%w %w %w %w %w","%w %w %w %w %w %w","%W%4d%W","%W%6d%s"],description=>...
# This script is generated by Perinci::CmdLine::Inline version 0.541 on Tue Jan 2 11:42:34 2018.
# Rinci metadata taken from these modules: App::Genpass::ID (no version)
# You probably should not manually edit this file.
our $DATE = '2018-01-02'; # DATE
our $VERSION = '0.003'; # VERSION
# PODNAME: genpass-id
# ABSTRACT: Generate password from combination of Indonesian words
# BEGIN DATAPACK CODE
{
my $toc;
my $data_linepos = 1;
unshift @INC, sub {
$toc ||= do {
my $fh = \*DATA;
my $header_line;
my $header_found;
while (1) {
my $header_line = <$fh>;
defined($header_line)
or die "Unexpected end of data section while reading header line";
chomp($header_line);
if ($header_line eq 'Data::Section::Seekable v1') {
$header_found++;
last;
}
}
die "Can't find header 'Data::Section::Seekable v1'"
unless $header_found;
my %toc;
my $i = 0;
while (1) {
$i++;
my $toc_line = <$fh>;
defined($toc_line)
or die "Unexpected end of data section while reading TOC line #$i";
chomp($toc_line);
$toc_line =~ /\S/ or last;
$toc_line =~ /^([^,]+),(\d+),(\d+)(?:,(.*))?$/
or die "Invalid TOC line #$i in data section: $toc_line";
$toc{$1} = [$2, $3, $4];
}
my $pos = tell $fh;
$toc{$_}[0] += $pos for keys %toc;
# calculate the line number of data section
my $data_pos = tell(DATA);
seek DATA, 0, 0;
my $pos = 0;
while (1) {
my $line = <DATA>;
$pos += length($line);
script/genpass-id view on Meta::CPAN
=head1 NAME
genpass-id - Generate password from combination of Indonesian words
=head1 VERSION
This document describes version 0.003 of main (from Perl distribution App-Genpass-ID), released on 2018-01-02.
=head1 SYNOPSIS
Usage:
% genpass-id [options]
=head1 DESCRIPTION
Using password from dictionary words (in this case, from WordList::*) can be
useful for humans when remembering the password. Note that using a string of
random characters is generally better because of the larger space (combination).
Using a password of two random words from a 5000-word wordlist has a space of
only ~25 million while an 8-character of random uppercase letters/lowercase
letters/numbers has a space of 62^8 = ~218 trillion. To increase the space
you'll need to use more words (e.g. 3 to 5 instead of just 2). This is important
if you are using the password for something that can be bruteforced quickly e.g.
for protecting on-disk ZIP/GnuPG file and the attacker has access to your file.
It is then recommended to use a high number of rounds for hashing to slow down
password cracking (e.g. C<--s2k-count 65011712> in GnuPG).
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--num>=I<s>, B<-n>
Default value:
1
=item B<--pattern>=I<s@>, B<-p>
Pattern(s) to use.
Default value:
["%w %w %w","%w %w %w %w","%w %w %w %w %w","%w %w %w %w %w %w","%W%4d%W","%W%6d%s"]
A pattern is string that is similar to a printf pattern. %P (where P is certain
letter signifying a format) will be replaced with some other string. %NP (where
N is a number) will be replaced by a word of length N, %N$Mw (where N and M is a
number) will be replaced by a word of length between N and M. Anything else will
be used as-is. Available conversions:
%w Random word, all lowercase.
%W Random word, first letter uppercase, the rest lowercase.
%s Random ASCII symbol, e.g. "-" (dash), "_" (underscore), etc.
%d Random digit (0-9).
%% A literal percent sign.
Can be specified multiple times.
=item B<--patterns-json>=I<s>
Pattern(s) to use (JSON-encoded).
See C<--pattern>.
=back
=head2 Configuration options
=over
=item B<--config-path>=I<filename>
Set path to configuration file.
Can be specified multiple times.
=item B<--config-profile>=I<s>
Set configuration profile to use.
=item B<--no-config>
Do not use any configuration file.
=back
=head2 Environment options
=over
=item B<--no-env>
Do not read environment for default options.
=back
=head2 Output options
=over
=item B<--format>=I<s>
Choose output format, e.g. json, text.
Default value:
undef
=item B<--json>
Set output format to json.
=item B<--naked-res>
script/genpass-id view on Meta::CPAN
# my $tff = $resmeta->{'table.fields'} or last;
# my $tfu = $resmeta->{'table.field_units'} or last;
# for my $i (0..$#columns) {
# my $field_idx = $field_idxs[$i];
# next unless $field_idx >= 0;
# next unless defined $tfu->[$field_idx];
# $data->[0][$i] .= " ($tfu->[$field_idx])";
# }
# }
#
# {
# my $tff = $resmeta->{'table.fields'} or last;
# my $tffmt = $resmeta->{'table.field_formats'} or last;
#
# my (@fmt_names, @fmt_opts);
# for my $i (0..$#columns) {
# my $field_idx = $field_idxs[$i];
# next unless $field_idx >= 0;
# next unless defined $tffmt->[$field_idx];
# if (ref($tffmt->[$field_idx]) eq 'ARRAY') {
# $fmt_names[$i] = $tffmt->[$field_idx][0];
# $fmt_opts [$i] = $tffmt->[$field_idx][1] // {};
# } else {
# $fmt_names[$i] = $tffmt->[$field_idx];
# $fmt_opts [$i] = {};
# }
# }
#
# my $nf;
#
# for my $i (0..$#{$data}) {
# next if $i==0 && $header_row;
# my $row = $data->[$i];
# for my $j (0..$#columns) {
# next unless defined $row->[$j];
# my $field_idx = $field_idxs[$j];
# next unless $field_idx >= 0;
# my $fmt_name = $fmt_names[$j];
# next unless $fmt_name;
# my $fmt_opts = $fmt_opts [$j];
# if ($fmt_name eq 'iso8601_datetime' || $fmt_name eq 'iso8601_date') {
# if ($row->[$j] =~ /\A[0-9]+\z/) {
# my @t = gmtime($row->[$j]);
# if ($fmt_name eq 'iso8601_datetime') {
# $row->[$j] = sprintf(
# "%04d-%02d-%02dT%02d:%02d:%02dZ",
# $t[5]+1900, $t[4]+1, $t[3], $t[2], $t[1], $t[0]);
# } else {
# $row->[$j] = sprintf(
# "%04d-%02d-%02d",
# $t[5]+1900, $t[4]+1, $t[3]);
# }
# }
# } elsif ($fmt_name eq 'boolstr') {
# $row->[$j] = $row->[$j] ? "yes" : "no";
# } elsif ($fmt_name eq 'sci2dec') {
# if ($row->[$j] =~ /\A(?:[+-]?)(?:\d+\.|\d*\.(\d+))[eE]([+-]?\d+)\z/) {
# my $n = length($1 || "") - $2; $n = 0 if $n < 0;
# $row->[$j] = sprintf("%.${n}f", $row->[$j]);
# }
# } elsif ($fmt_name eq 'percent') {
# my $fmt = $fmt_opts->{sprintf} // '%.2f%%';
# $row->[$j] = sprintf($fmt, $row->[$j] * 100);
# } elsif ($fmt_name eq 'number') {
# require Number::Format::BigFloat;
# $row->[$j] = Number::Format::BigFloat::format_number(
# $row->[$j], {
# thousands_sep => $fmt_opts->{thousands_sep} // ',',
# decimal_point => $fmt_opts->{decimal_point} // '.',
# decimal_digits => $fmt_opts->{precision} // 0,
# });
# }
# }
# }
# }
#
# if ($format eq 'text-pretty') {
# {
# no warnings;
#
# my $tfa = $resmeta->{'table.field_aligns'} or last;
# last unless @$data;
#
# for my $colidx (0..$#columns) {
# my $field_idx = $field_idxs[$colidx];
# next unless $field_idx >= 0;
# my $align = $tfa->[$field_idx];
# next unless $align;
#
# my $maxw;
# my ($maxw_bd, $maxw_d, $maxw_ad);
# if ($align eq 'number') {
# my (@w_bd, @w_d, @w_ad);
# for my $i (0..$#{$data}) {
# my $row = $data->[$i];
# if (@$row > $colidx) {
# my $cell = $row->[$colidx];
# if ($header_row && $i == 0) {
# my $w = length($cell);
# push @w_bd, 0;
# push @w_bd, 0;
# push @w_ad, 0;
# } elsif ($cell =~ /\A([+-]?\d+)(\.?)(\d*)\z/) {
# push @w_bd, length($1);
# push @w_d , length($2);
# push @w_ad, length($3);
# } elsif ($cell =~ /\A([+-]?\d+\.?\d*)([eE])([+-]?\d+)\z/) {
# push @w_bd, length($1);
# push @w_d , length($2);
# push @w_ad, length($3);
# } else {
# push @w_bd, length($cell);
# push @w_bd, 0;
# push @w_ad, 0;
# }
# } else {
# push @w_bd, 0;
# push @w_d , 0;
# push @w_ad, 0;
# }
# }
( run in 2.136 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )