in reply to DES ECB mode using DES_PP
The module expects the key to be in bytes, not in hexadecimal nibbles:
use strict; use Crypt::ECB qw(encrypt decrypt encrypt_hex decrypt_hex); my $ascii_key = "0123456789abcdef"; my $key= "\x01\x23\x45\x67\x89\xab\xcd\xef"; my $plain_text = "Now is the time for all "; my $expected= '3fa40e8a984d48156a271787ab8883f9893d51ec4b563b53'; my $result= encrypt_hex($key,"DES_PP",$plain_text,0); if( $result eq $expected ) { print "Yay\n"; } else { print "Got : $result\n"; print "Expected: $expected\n"; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: DES ECB mode using DES_PP
by v4169sgr (Sexton) on Aug 29, 2014 at 09:48 UTC |