Code Comments
Programming Forum and web based access to our favorite programming groups.Hello,
I have a problem with the tcllib 1.9 DES package used with tcl 8.5.
If I use the following, discrepancies between the orignal and the en-/
decrypted text appears:
% set microseconds [expr {wide([clock clicks -microseconds])}];
1187952939896309
% set asciiData "Hello World!"
% set encryptedData [::DES::des -mode cbc -dir encrypt -key
$microseconds $asciiData]
??+=C7my?-=AC*?+=A6$-=A6?-=E2-=A6B
% set decryptedData [::DES::des -mode cbc -dir decrypt -key
$microseconds $encryptedData]
Hello World!+=C7+=C7+=C7+=C7
Is this a known behaviour in tcl 8.5, or should I file a bug?
Best regards,
Martin Lemburg
Post Follow-up to this messageFrom the des man page:
DES is a 64-bit block cipher. This means that the data must be provided
in units that are a multiple of 8 bytes.
Add sufficient spaces. to pad this to 16 bytes from the 12 bytes you are
passing...(each of the +Ç is a byte evidently.. they
represent the 4 chars junk in the encryption buffer probably.
Note that this will be true of many modern encryption algorithms
(that they operate on fixed sized blocks, and will need explicit
padding).
Ron
MartinLemburg@UGS wrote:
> Hello,
>
> I have a problem with the tcllib 1.9 DES package used with tcl 8.5.
>
> If I use the following, discrepancies between the orignal and the en-/
> decrypted text appears:
>
> % set microseconds [expr {wide([clock clicks -microseconds])}];
> 1187952939896309
> % set asciiData "Hello World!"
> % set encryptedData [::DES::des -mode cbc -dir encrypt -key
> $microseconds $asciiData]
> ??+Çmy?-¬*?+¦$-¦?-â-¦B
> % set decryptedData [::DES::des -mode cbc -dir decrypt -key
> $microseconds $encryptedData]
> Hello World!+Ç+Ç+Ç+Ç
>
> Is this a known behaviour in tcl 8.5, or should I file a bug?
>
> Best regards,
>
> Martin Lemburg
>
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.