Use 
```php
$iv = Crypto::randcode($ivsize);
```
which should be more consistent between *nix and Windows®