Displaying 1 result from an estimated 1 matches for "get_rnd_iv".
2008 Dec 13
2
Need Help in converting php encryption decryption code to ruby on rails
...block cypher ( MDC-like ),
#** which works in 128bit CFB mode. It is very useful to
#** encrypt secret data before transfer it over the network.
#**
#** $iv_len - initialization vector''s length.
#** 0 <= $iv_len <= 512
#**
#************************************************/
#
function get_rnd_iv( $iv_len )
{
$iv = '''';
while ( $iv_len-- > 0 )
{
$iv .= chr( mt_rand( ) & 0xff );
}
return $iv;
}
function md5_encrypt( $plain_text, $password, $iv_len = 16 )
{
$plain_text .= "\x13";
$n = strlen( $plain_text );
if (...