Skip to content

Instantly share code, notes, and snippets.

@lkorth
lkorth / generate_key.php
Last active February 20, 2016 22:02
PHP function for generating cryptography secure strings of a given length
<?php
/**
* PHP function for generating cryptography secure strings of a given length
*
* @param $length the length in bytes for the generated key
* @return the cryptography secure string of {$length} length
*/
function generate_key($length) {
$strong = FALSE;