I am looking to create a variable length UTF-8 string in PHP. I tried this method initially:
utf8_encode(mcrypt_create_iv(256, MCRYPT_DEV_URANDOM))
But it gave me a string longer than 256 chars
I then tried this method:
md5(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM))
Which works for a 32 character long string but if I want a 256 long string I need to concatenate it 8 times which seems inefficient.
How would I do this efficiently in PHP? Thanks
Aucun commentaire:
Enregistrer un commentaire