code: def entropy(string):
      
      entropy = 0
      for number in range(256):
          result = float(string.encode('utf-8').count(
              chr(number))) / len(string.encode('utf-8'))
          if result != 0:
              entropy = entropy - result * math.log(result, 2)
      return entropy
docs: Calculate the entropy of a string.