Untitled

Anonymous
plain_text
06/04/2022 4:00 PM
496 B
32
Indexable
import math

def ChartoNibbledHex(a):
  x,y=[],[]
  for i in a:
    x.append(ord(i)) # convert string character to ascii value
  for i in x:
    nib1 = str(int(bin(i)[2:])).zfill(4)[:4]
    nib2 = str(int(bin(i)[2:])).zfill(8)[4:]
    y.append (hex(int(nib1+'0000')))
    y.append (hex(int(nib2+'0000')))

  return y

print(ChartoNibbledHex("Hello world"))
Editor is loading...