함수 random bytes()

함수 random_bytes()

1 PHP[ | ]

function random_bytes($length) {
	if ($length < 1) return false;
	$secure = true;
	$result = openssl_random_pseudo_bytes($length, $secure);
	if ($result == false || !$secure) return false;
	if (strlen($result) != $length) return false;
	return $result;
}
var_dump( random_bytes(10) );
var_dump( random_bytes(40) );
# string(10) "°±|U쪖¯"
# string(40) "^ÿ°¿8ޜ]󵐍
# ²笺Āt헏V%t

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}