encode Netbios name python

試著忘記壹切 提交于 2019-12-06 15:41:24

You can map each nibble of the original string, taking its numerical value and offsetting from 'A':

encoded_name = ''.join([chr((ord(c)>>4) + ord('A'))
                        + chr((ord(c)&0xF) + ord('A')) for c in original_name])

Take a look at RFC 1001, which defines the encoding. In section 14.1 "FIRST LEVEL ENCODING" is the algorithm for the encoding, which you could implement directly in Python.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!