douhan4243 2010-02-18 16:40
浏览 47
已采纳

OTP或S / KEY - 将十六进制字符串转换为6个可读字

As seen in RFC2289 (S/KEY), there is a list of words that must be used when converting the hexadecimal string into a readable format.

How would i go about doing so?

The RFC mentions:

The one-time password is therefore converted to, and accepted as, a sequence of six short (1 to 4 letter) English words. Each word is chosen from a dictionary of 2048 words; at 11 bits per word, all one-time passwords may be encoded.

Read more: http://www.faqs.org/rfcs/rfc1760.html#ixzz0fu7QvXfe

Does this mean converting a hex into decimal and then using that as an index for an array of words. The other thing it could be is using a text encoding e.g. 1111 might equal dog in UTF-8 encoding

thanks in advance for your help!

  • 写回答

1条回答 默认 最新

  • duanhuanyou6478 2010-02-18 16:55
    关注

    There's no need to convert to decimal. If your hex value is a string, just convert it to a number (for example, with Integer.valueOf(value, 16)). Then use that number to look up the word. If you can store the whole dictionary in memory, use the number as the index. If you can't store it in memory, use it to control how far into the dictionary file you look (if every item is on a separate line, read that many lines into the file). If you've got a database somewhere, use the number as the table's key and select by key.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题