Crypt-Unsnoopable
view release on metacpan or search on metacpan
bin/unsnoopable.pl view on Meta::CPAN
# $padsel->SetStringSelection($pads->[0]->{name});
# my $selbox = Wx::BoxSizer->new(wxHORIZONTAL);
# $selbox->Add($padsel, 2, wxALL, 5);
my $topSizer = Wx::BoxSizer->new(wxVERTICAL);
$frame->SetSizer($topSizer);
my $boxSizer = Wx::BoxSizer->new(wxVERTICAL);
$topSizer->Add($boxSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALL | wxEXPAND, 5);
$boxSizer->Add($padsel, 0, wxGROW | wxALL, 5);
# Buttons
my %button;
$button{Generate} = Wx::Button->new($frame, -1, _('Generate'), [-1,-1] );
$button{Import} = Wx::Button->new($frame, -1, _('Import'), [-1, -1]);
$button{Send} = Wx::Button->new($frame, -1, _('Send'), [-1, -1]);
$button{Receive} = Wx::Button->new($frame, -1, _('Receive'), [-1, -1]);
$button{Export} = Wx::Button->new($frame, -1, _('Export'), [-1,-1]);
$button{Exit} = Wx::Button->new($frame, -1, _('Exit'), [-1,-1]);
my $buttonbox1 = Wx::BoxSizer->new(wxHORIZONTAL);
$boxSizer->Add($buttonbox1, 0, wxGROW | wxALL, 5);
$buttonbox1->Add($button{Generate}, 1, wxALL, 5);
$buttonbox1->Add($button{Import}, 1, wxALL, 5);
$buttonbox1->Add($button{Export}, 1, wxALL, 5);
my $buttonbox2 = Wx::BoxSizer->new(wxHORIZONTAL);
$boxSizer->Add($buttonbox2, 0, wxGROW | wxALL, 5);
$buttonbox2->Add($button{Send}, 1, wxALL, 5);
$buttonbox2->Add($button{Receive}, 1, wxALL, 5);
$buttonbox2->Add($button{Exit}, 1, wxALL, 5);
# Status bar
my $statusBar = Wx::StatusBar->new($frame, wxID_ANY);
$frame->SetStatusBar($statusBar);
return ($app, $frame, $padsel, $topSizer, $boxSizer, $statusBar, %button)
}
sub initl8n { # Initialize l8n
$lang{en}->{__NAME} = 'English';
$lang = 'en';
if ($^O eq 'MSWin32') {
my %winlang = ( de => [qw(0007 0c07 0407 1407 1007 0807)],
es => [qw(000a 2c0a 200a 400a 340a 240a 140a 5c0a 1c0a 300a 440a 100a 480a 580a 080a 4c0a 180a 3c0a 280a 500a 040a 0c0a 540a 380a)],
fr => [qw(000c 080c 2c0c 240c 300c 040c 3c0c 140c 340c 380c 180c 200c 280c 100c)],
gr => [qw(0008 0408)],
hi => [qw(0039 0439)],
it => [qw(0010 0410 0810)],
ja => [qw(0011 0411)],
kr => [qw(0012 0412)],
ru => [qw(0019 0819 0419)],
zh => [qw(0004 7804 0804 1004 7c04 0c04 1404 0404)]
);
require Win32::API;
Win32::API->Import('kernel32', 'int GetUserDefaultLCID()');
my $langid = GetUserDefaultLCID();
for my $l (keys %winlang) {
$lang = $l, last if grep { sprintf("%04x",$langid) eq $_ } @{$winlang{$l}};
}
# print STDERR "$lang\n";
}
else {
$lang = $ENV{LC_ALL} || $ENV{LANG};
}
$lang = 'en' unless defined $lang;
$lang = 'en' if $lang =~ /^C|POSIX/;
$lang = substr($lang, 0, 2) || 'en';
return ($lang, %lang);
}
sub _ {
$_ = shift;
if (/^\d+$/) {
if ($lang eq 'h1') {
$numerals = $lang{$lang}->{__NUMERALS};
eval "tr/0-9/$numerals/";
}
return $_;
}
else {
if ($lang eq 'hi' and $ENV{DISPLAY} and $ENV{DISPLAY} !~ /apple/) {
return $lang{$lang}->{__X11}->{$_} || $_;
}
else {
return $lang{$lang}->{$_} || $_;
}
}
}
1;
__END__
=head1 NAME
unsnoopable.pl - Completely unsnoopable messaging
=head1 VERSION
$Revision: 1.010 $
$Date: Tue Oct 16 21:04:28 PDT 2018 $
=head1 SYNOPSIS
unsnoopable.pl [--noodlepi]
=head1 DESCRIPTION
unsnoopable.pl (Unsnoopable) is a simple application for end-to-end
completely unsnoopable messaging. It is intended to be run on
air-gapped devices that are never connected to any networks and have
no wireless networking hardware. Unsnoopable uses one-time pads (OTPs)
for completely unbreakable encryption.
Unsnoopability goes further than unbreakability of encryption, as a
compromised device can leak plaintext even when the encryption used to
transmit the message is unbreakable. This is the reason Unsnoopable is
designed for use on an air-gapped devices, with a screen, text input
( run in 0.600 second using v1.01-cache-2.11-cpan-5735350b133 )