https://github.com/peerxu/koalemos
A Stupid Game
https://github.com/peerxu/koalemos
Last synced: 3 months ago
JSON representation
A Stupid Game
- Host: GitHub
- URL: https://github.com/peerxu/koalemos
- Owner: PeerXu
- License: gpl-2.0
- Created: 2015-08-18T11:16:39.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-18T16:14:02.000Z (almost 10 years ago)
- Last Synced: 2024-04-16T18:24:28.185Z (about 1 year ago)
- Language: Python
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Koalemos
Koalemos -- A Stupid GameSHA1是一个哈希函数, 输入是任意字符串, 输出是由40位16进制组成.
本游戏是查找输出中, 包含N个字符的游戏.
## 无聊的算法
### 输入输出定义
输入: 种子串`s`, 查询字符`x`, 重复次数`n`
输出: 替换值`r`, 重复字符`x` `n`次的`sha1函数`值`h`1. `s`是40位16进制字符串.
2. `x`是任意1个16进制字符.
3. `n`由1到40次.
4. `r`是1到40位16进制字符串. 替换规则是替换`s`的右边`m`位, `m`为`r`的长度.
5. `h`是`sha1函数`的40位16进制字符串.### 算法过程
1. 初始化 `r` = "0"
2. 通过替换规则`fr`, 使用`r`替换`s`, 得到`th`
3. 如果`th`含有`n`或以上个`x`字符, 则`h=th`, 返回`(r, h)`
4. 否则, 通过更新规则`ff`, 得到新的`r`, 再重复步骤2* 替换规则`fr`: `s`的右边`m`位, 替换成`r`.
> `s = "abcdefgh", r = "abc", fr(s, r) = "abcdeabc"`
* 更新规则`ff`: 将 `r+1`
> `r = "a", ff(r) = hex(int(r) + 1)`