ecb works , but cfb and cbc don't ( php )
- From: veg_all@xxxxxxxxx
- Date: 22 Jul 2006 12:23:30 -0700
I am reading that cbc and cfb are better than ecb, but I can not get
this php code below to work. It works fine for ebc, but not for cbc or
cfb. What could I be missing? Is it something to do with the byte
length of the input string? If I use a longer string, I notice it does
decrypt some of the string ok, but not the beginning?
<?php
$input = 'Hello World Today';
$key = '12345';
$td = mcrypt_module_open('rijndael-128', '', 'cbc', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND );
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = mcrypt_generic($td, $input);
$decrypted = mdecrypt_generic($td, $encrypted_data );
?>
.
- Follow-Ups:
- Re: ecb works , but cfb and cbc don't ( php )
- From: David Wagner
- Re: ecb works , but cfb and cbc don't ( php )
- From: Tom St Denis
- Re: ecb works , but cfb and cbc don't ( php )
- Prev by Date: Re: lack of encryption in instant messengers
- Next by Date: Re: ecb works , but cfb and cbc don't ( php )
- Previous by thread: MAC for real time data
- Next by thread: Re: ecb works , but cfb and cbc don't ( php )
- Index(es):
Relevant Pages
|