Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

匿名功能:从#anony_散列生成随机六位数中文名 #11

Closed
crella6 opened this issue Sep 20, 2020 · 1 comment
Closed

匿名功能:从#anony_散列生成随机六位数中文名 #11

crella6 opened this issue Sep 20, 2020 · 1 comment
Labels
feature New feature or request

Comments

@crella6
Copy link

crella6 commented Sep 20, 2020

匿名功能:从#anony_散列生成随机六位数中文名
(不会用Github相关功能,只提issue算了)
我是写其他语言的,这个Python代码我是临时学的,验证了5组匿名用户名。

# coding=utf-8
anony_string1 = '甲乙丙丁戊己庚辛壬癸子丑寅卯辰巳午未申酉戌亥'
anony_string2 = '王李张刘陈杨黄吴赵周徐孙马朱胡林郭何高罗郑梁谢宋唐许邓冯韩曹曾彭萧蔡潘田董袁于余叶蒋杜苏魏程吕丁沈任姚卢傅钟姜崔谭廖范汪陆金石戴贾韦夏邱方侯邹熊孟秦白江阎薛尹段雷黎史龙陶贺顾毛郝龚邵万钱严赖覃洪武莫孔汤向常温康施文牛樊葛邢安齐易乔伍庞颜倪庄聂章鲁岳翟殷詹申欧耿关兰焦俞左柳甘祝包宁尚符舒阮柯纪梅童凌毕单季裴霍涂成苗谷盛曲翁冉骆蓝路游辛靳管柴蒙鲍华喻祁蒲房滕屈饶解牟艾尤阳时穆农司卓古吉缪简车项连芦麦褚娄窦戚岑景党宫费卜冷晏席卫米柏宗瞿桂全佟应臧闵苟邬边卞姬师和仇栾隋商刁沙荣巫寇桑郎甄丛仲虞敖巩明佘池查麻苑迟邝'

'''
  测试数据, 论坛网页处理Javascript函数是commonui.anonyName()
  # '#anony_9c51a20a7c7e7d1c6a92e3de2fda8e78'  癸芦邓甲靳褚
  # '#anony_b34a67e8d3d527fb3be72768afaa6afd'  丑傅辛辰符金
  # '#anony_33b9c16f49748c9179d16cc12493765a'  丁汪苗庚虞季
  # '#anony_692ac06925dfd03c7f328c5636f968bb'  庚梅华庚梅严
  # '#anony_1af8b011e25dd2be72e84e8ee011e6e1'  乙蒲宁乙曾袁
'''

def anony_alias(anony_name):
  # 根据匿名散列生成随机六位中文名, 函数传入形式: '#anony_9c51a20a7c7e7d1c6a92e3de2fda8e78'
  res = ''
  str16 = '0x0' + anony_name[7]
  res += anony_string1[int(str16, 16)]
  str16 = '0x' + anony_name[8:10]
  res += anony_string2[int(str16, 16)]
  str16 = '0x' + anony_name[10:12]
  res += anony_string2[int(str16, 16)]
  str16 = '0x0' + anony_name[13]
  res += anony_string1[int(str16, 16)]
  str16 = '0x' + anony_name[14:16]
  res += anony_string2[int(str16, 16)]
  str16 = '0x' + anony_name[16:18]
  res += anony_string2[int(str16, 16)]
  res += '?'
  return res

aname = '#anony_1af8b011e25dd2be72e84e8ee011e6e1'
print(anony_alias(aname))

建议用 https://bbs.nga.cn/read.php?tid=23362790&page=6 来测试。这个网页不会过时,且以下匿名用户有对应的很多楼层:
癸芦邓甲靳褚?:0、31、41、51、73、78、104、111、124、135楼
丑傅辛辰符金?:9、39楼
卯柯郑辰赖龚?:117楼

同时回帖内容bbcode里的

r'\[quote\].+?\[uid.*?\](.+?)\[/uid\].*?\((\d{4}.+?)\):\[/b\](.+?)\[/quote\]((?:\n){0,2})'

r'\[b\]Reply to .+? Post by \[uid.*?\](.+?)\[\/uid\] \((.+?)\)\[\/b\]((?:\n){0,2})'

里也可能会出现#anony_XXX的形式。

@ludoux
Copy link
Owner

ludoux commented Sep 20, 2020 via email

@ludoux ludoux closed this as completed in ebb69b4 Sep 29, 2020
@ludoux ludoux added the feature New feature or request label Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants