[BACK]Return to test1.pl CVS log [TXT][DIR] Up to [local] / palm / Palm-Keyring

File: [local] / palm / Palm-Keyring / test1.pl (download)

Revision 1.2, Fri Nov 10 17:35:40 2006 UTC (17 years, 6 months ago) by andrew
Branch: MAIN
Changes since 1.1: +1 -1 lines

dump the encrypted as hex, since I can't read the special chars anyway

#!/usr/bin/perl
use strict;
use warnings;

use lib 'lib';
use Palm::Keyring;

use constant ENCRYPT    =>  1;
use constant DECRYPT    =>  0;

my $plaintext = "Hello World";
my $password  = "12345";

my $digest    = Palm::Keyring::_calc_keys($password);
my $encrypted = Palm::Keyring::_crypt3des($plaintext, $digest, ENCRYPT);
my $decrypted = Palm::Keyring::_crypt3des($encrypted, $digest, DECRYPT);

print "Plaintext: $plaintext\n";
print "Password:  $password\n";
print "Digest:    $digest\n";
print "Encrypted: " . unpack("H*", $encrypted) . "\n";
print "Decrypted: $decrypted\n";