[Bug]: Discrepancy of extended Token with legacy library
还没有人认领这个 Issue。
评估
调研方向
首先运行 issue 中的 Python 示例,并针对扩展 ADD_TIME token 比较 OpenPAYGOTokenEncoder.generate_token 与 legacy generate_extended_token。跟踪扩展模式下 token 类型和计数的处理方式,然后根据 legacy 输出或明确确认的预期行为验证结果。issue 未提及任何 repository 文件或测试。
由索引模型根据 Issue 内容生成。
描述
Preflight Checklist
- I have read the Contributing Guidelines for this project, if it exists.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Expected Behavior
Legacy and new library should generate the same extended tokens.
Actual Behavior
When generating extended tokens there is a difference for ADD_TIME tokens.
New lib:
# OpenPAYGO-python
from openpaygo import OpenPAYGOTokenEncoder, TokenType
encoder = OpenPAYGOTokenEncoder()
new_count, final_token = encoder.generate_token(
secret_key="bc41ec9530f6dac86b1a29ab82edc5fb",
count=2,
value=1,
token_type=TokenType.ADD_TIME,
starting_code=516959010,
restricted_digit_set=False,
extended_token=True,
)
print(f"{new_count=}")
print(f"{final_token=}")
yields
new_count=4
final_token='584694959011'
Legacy:
# OpenPAYGO Token
import codecs
from importlib import import_module
openpaygo_token = import_module("openpaygo-token")
encoder = openpaygo_token.OPAYGOEncoder()
shared = openpaygo_token.OPAYGOShared
new_count, final_token = encoder.generate_extended_token(
key=codecs.decode("bc41ec9530f6dac86b1a29ab82edc5fb", "hex"),
count=2,
value=1,
# mode=shared.TOKEN_TYPE_ADD_TIME,
starting_code=516959010,
restricted_digit_set=False,
)
print(f"{new_count=}")
print(f"{final_token=}")
new_count=3
final_token='660362959011'
Steps to reproduce
Run the code from above.
This might be related to the legacy being hardcoded to SET_TIME for extended mode. Is the expected behaviour?
What operating system(s) are you using?
macOS
Additional Information
No response
- 主要语言
- Python
- 星标
- 15
- 派生
- 15
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
EnAccess/OpenPAYGO-python 的其他 Issue
-
Provide explicit type hints and pydantic validation for robust usage可能已有人在做 @lupppig 于 215 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
EnAccess/OpenPAYGO-python#34 ·
-
bug
难度 3/5 1-2 天 新手友好度 45/100
EnAccess/OpenPAYGO-python#25 ·
-
bug
难度 3/5 1-2 天 新手友好度 45/100
EnAccess/OpenPAYGO-python#24 ·
-
enhancement
难度 3/5 1-2 天 新手友好度 45/100
EnAccess/OpenPAYGO-python#22 ·
-
Create test cases for all token modes可能已有人在做 @dmohns 于 703 天前认领。 未关闭documentation enhancement good first issue hacktoberfest help wanted
难度 5/5 一周以上 新手友好度 25/100
EnAccess/OpenPAYGO-python#15 ·
查看 EnAccess/OpenPAYGO-python 的全部 Issue
相似的 Issue
-
area: desktop area: website priority: P2 type: feature
难度 2/5 1-3 小时 新手友好度 62/100
appandflow/stim#3411 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1 小时以内 新手友好度 88/100
baptistehamon/lsapy#185 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
PolicyEngine/policyengine-us#10073 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
syedhamidali/radarx#277 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
Arekkazu/sgpmp-backend#549 ·
维护者通常 1 天内回复