# Sender $cipher->start('encrypting'); print $sock $cipher->crypt($_) while ; print $sock $cipher->finish(); #### # Receiver $cipher->start('decrypting'); local $/ = \4096; process_bytes($cipher->crypt($_)) while <$sock>; process_bytes($cipher->finish()); #### # Interactive receiver $cipher->start('decrypting'); for (;;) { my $rv = sysread($sock, my $buf='', 4096); die $! if !defined $rv last if !$rv; process_bytes($cipher->crypt($buf)); } process_bytes($cipher->finish());