Welcome Guest, Not a member yet? Register   Sign In
get_random_bytes() bad resut?
#1

(This post was last modified: 08-19-2015, 11:43 AM by dansanti.)

HI! I try with $this->security->get_random_bytes(64) on CI3 on last commit, get a string with 64 chars, but only return an unreadable string with strangly codes and a lot of blank spaces.

To use this feature, server needs a special library installed?

Thanks.
Reply
#2

If it failed, it would return FALSE. I'm not sure what you're expecting to receive from get_random_bytes() other than a string of random bytes the requested length...
Reply
#3

It returns bytes, not characters...
Reply
#4

(08-19-2015, 12:55 PM)ivantcholakov Wrote: It returns bytes, not characters...

Not necessarily printable ASCII characters, to be more precise.

To make the result easier to work with (i.e. easy to copy into a config file), it may be converted to a hex string via bin2hex() and then unpacked via hex2bin() when used.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB