Crypt-Unsnoopable

 view release on metacpan or  search on metacpan

bin/unsnoopable.pl  view on Meta::CPAN

  my $name = $dialog->GetValue(); return unless $name =~ /^[\w\d\s]+$/; return if exists $pads->{$name};
  my $pad = $u->otpgen(2935, $name);
  $pads = $u->otps;
  $padsel->Insert("$name (2935)", 0);
  show();
};

$action{Import} = sub {     # Import OTP
  my ($dialog, $pad);
  if ($NOODLEPI) {
    system ('v4l2-ctl --overlay=1');
    open (ZBAR, "zbarcam --nodisplay --prescale=640x480 /dev/video0 |");
    $pad = <ZBAR>; chomp $pad; $pad =~ s/^QR-Code://;
    system ('killall -9 zbarcam');
    close ZBAR;
    system ('v4l2-ctl --overlay=0');
    print "$pad\n";
  }
  else {
    $dialog = Wx::TextEntryDialog->new( $frame, "Paste pad below", "Import One-Time Pad");
    return if($dialog->ShowModal == wxID_CANCEL);
    $pad = $dialog->GetValue();
  }
  return if $pad =~ /\D/;
  $dialog = Wx::TextEntryDialog->new( $frame, "Enter a name for this pad:", "Import One-Time Pad");
  return if $dialog->ShowModal == wxID_CANCEL;

bin/unsnoopable.pl  view on Meta::CPAN

  return unless my $encrypted = $u->encrypt($pad_name, $msg);
  my $len = length($u->otps->{$pad_name}->{pad})/2;
  $padsel->SetString($selnum, "$pad_name ($len)");
  $dialog = qrdialog($encrypted, 'Scan the QR code or copy message from below', 'Send message');
  $dialog->ShowModal;
};

$action{Receive} = sub {    # Receive a message
  my ($dialog, $msg);
  if ($NOODLEPI) {
    system ('v4l2-ctl --overlay=1');
    open (ZBAR, "zbarcam --nodisplay --prescale=640x480 /dev/video0 |");
    $msg = <ZBAR>; chomp $msg; $msg =~ s/^QR-Code://;
    system ('killall -9 zbarcam');
    close ZBAR;
    system ('v4l2-ctl --overlay=0');
    print "$msg\n";
  }
  else {
    $dialog = Wx::TextEntryDialog->new( $frame, "Enter message:", "Receive message");
    return if $dialog->ShowModal == wxID_CANCEL;
    $msg = $dialog->GetValue();
  }
  return unless $msg;
  return unless my ($decrypted, $pad, $oldlen) = $u->decrypt($msg);
  my $padlen = length($pad->{pad})/2;



( run in 0.861 second using v1.01-cache-2.11-cpan-49f99fa48dc )