Iterate through n bit chunks of a byte string
I have a code like this: $alphabet = array(‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,’a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’,’j’,’k’,’l’,’m’,’n’,’o’,’p’,’q’,’r’,’s’,’t’,’u’,’v’,’w’,’x’,’y’,’z’); $alphabetSize = count($alphabet); $alphabetBitSize = ceil(log($alphabetSize, 2)); $bitSize = $length * $alphabetBitSize; $bytes = random_bytes(ceil($bitSize/8)); What I need is reading $bitSize bits in a loop to generate a latin1 string using the alphabet. Now I am totally lost about how to do this with the $bytes… Read More Iterate through n bit chunks of a byte string