Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uzulla/sha256-resolver.php
This is just for fun.
https://github.com/uzulla/sha256-resolver.php
Last synced: about 2 months ago
JSON representation
This is just for fun.
- Host: GitHub
- URL: https://github.com/uzulla/sha256-resolver.php
- Owner: uzulla
- Created: 2021-02-14T06:01:56.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-20T10:25:51.000Z (almost 4 years ago)
- Last Synced: 2023-03-23T12:14:15.593Z (almost 2 years ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sha256 resolver
これは教育目的(あるいは暖房)のためのプログラムです。
sha256のハッシュ値から、元の値(あるいはコリジョン値)を力技で求めます。
「SHA256を『戻す』のは現実的ではない」&「短い入力ではSHA256であっても無力」
## requirement
GMP and other, please see head of code.
## how to use
```
# single(simple) version
$ time php sha256_resolve.php fb8e20fc2e4c3f248c60c39bd652f3c1347298bb977b8b4d5903b85055620603
# short(and invalid) version
$ time php sha256_resolve_short.php fb8e20fc2e4c3f248c60c39bd652f3c1347298bb977b8b4d5903b85055620603
# fork version
$ time php sha256_resolve_fork.php fb8e20fc2e4c3f248c60c39bd652f3c1347298bb977b8b4d5903b85055620603 8
# short fork version
$ time php sha256_resolve_fork_short.php fb8e20fc2e4c3f248c60c39bd652f3c1347298bb977b8b4d5903b85055620603 8
```> These `short`(w/o gmp) version is fast than gmp version. but, max resolvable length of short version is 15chars. If you need more chars(ex:64 chars), avoid to use `short` version.
> (Ofcourse, the tool is toooooo000ooo slow. You will NOT to be reach PHP_INT_MAX in easyly.)
## sample hash
```
$ php -a
Interactive shellphp > echo hash("sha256", "a");
ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb
php > echo hash("sha256", "ab");
fb8e20fc2e4c3f248c60c39bd652f3c1347298bb977b8b4d5903b85055620603
php > echo hash("sha256", "abc");
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
php > echo hash("sha256", "abcd");
88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031589
php > echo hash("sha256", "abcde");
36bbe50ed96841d10443bcb670d6554f0a34b761be67ec9c4a8ad2c0c44ca42c
php > echo hash("sha256", "abcdef");
bef57ec7f53a6d40beb640a780a639c83bc29ac8a9816f1fc6c5c6dcd93c4721
php > echo hash("sha256", "abcdef1");
ac9f830ae6cf2299ba293dd4cec3be0d87a88e6a8fbfe5015de6fffd11d79b6e
```## sample result
## fork version
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 + xdebug `a` => 0m0.102s
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 + xdebug `ab` => 0m0.108s
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 + xdebug `abc` => 0m0.124s
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 + xdebug `abcd` => 0m0.529s
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 + xdebug `abcde` => 0m7.334s
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 + xdebug `abcdef` => 0m3.159s
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 + xdebug `abcdef1` => 2m0.772s
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 + xdebug `abcdef1` => 2m0.772s
- Mac mini 2018 (Core i7-8700B @ 3.20GHz) 16 worker. macOS catalina + PHP7.4.9 + xdebug `abcdef` => 0m3.685s
- Mac mini 2018 (Core i7-8700B @ 3.20GHz) 16 worker. macOS catalina + PHP7.4.9 + xdebug `abcdef1` => 2m28.340s
- Macbook Pro 2020 M1 8 worker. macOS Big Sur + PHP ([php-src:8ffc20](https://github.com/php/php-src/tree/8ffc20ace6c8a59b30aea53e2100aa26e4f1f3ee)) `abc` => 0m0.023s
- Macbook Pro 2020 M1 8 worker. macOS Big Sur + PHP ([php-src:8ffc20](https://github.com/php/php-src/tree/8ffc20ace6c8a59b30aea53e2100aa26e4f1f3ee)) `abcd` => 0m0.067s
- Macbook Pro 2020 M1 8 worker. macOS Big Sur + PHP ([php-src:8ffc20](https://github.com/php/php-src/tree/8ffc20ace6c8a59b30aea53e2100aa26e4f1f3ee)) `abcde` => 0m0.707s
- Macbook Pro 2020 M1 8 worker. macOS Big Sur + PHP ([php-src:8ffc20](https://github.com/php/php-src/tree/8ffc20ace6c8a59b30aea53e2100aa26e4f1f3ee)) `abcdef` => 0m1.795s
- Macbook Pro 2020 M1 8 worker. macOS Big Sur + PHP ([php-src:8ffc20](https://github.com/php/php-src/tree/8ffc20ace6c8a59b30aea53e2100aa26e4f1f3ee)) `abcdef1` => 0m25.928s## fork short(w/o gmp)
- Thinkpad X13 (AMD Ryzen 7 PRO 4750U) 16 worker. Linux + PHP 8.0.2 `abcdef1` => 0m13.845s