Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
NETBIOS encode/decode
# Implemented the reverse of the compact answer on:
def netbios_encode(input_string):
return ''.join([chr((ord(c)>>4)+ord('A'))+chr((ord(c)&0xF)+ord('A')) for c in input_string])
def netbios_decode(netbios):
i = iter(netbios.upper())
return ''.join([chr(((ord(c)-ord('A'))<<4)+((ord(next(i))-ord('A'))&0xF)) for c in i])
return ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment