homepage Welcome to WebmasterWorld Guest from 54.205.122.62
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Help with hex initialization vector
Sub_Seven



 
Msg#: 4288812 posted 2:18 am on Mar 29, 2011 (gmt 0)

Hello everyone,

I am being requested to generate an initialization vector in hex code (16 characters) and I am unsure of a few things; I'm using this code to generate and echo the IV:

$size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);
$iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
echo $iv;


But what I get looks like this:

�HJ-�uj��X))

My questions:

1. Is it supposed to be displayed with those unusual characters?
2. If yes to question #1 and that's how its supposed to be, there are 15 characters there, how can I make it 16 characters long?

I got caught in a complete new topic here, any help will be greatly welcome,

Thanks.

EDIT: When displayed in this forum it looks different than what I get in my page.

 

Sub_Seven



 
Msg#: 4288812 posted 12:15 am on Mar 30, 2011 (gmt 0)

Could someone help me a little here please?

Thanks

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4288812 posted 5:33 pm on Mar 30, 2011 (gmt 0)

  1. Yes, it's encrypted.
  2. Use mcrypt_enc_get_iv_size [php.net] to see the size of the IV of the opened algorithm. I have never trimmed the IV. Leave that alone. Use the "get encrypted iv size" functions during decrypt to substring that part off the payload data.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved