87 lines
1.7 KiB
Markdown
87 lines
1.7 KiB
Markdown
# NOJSCAP client
|
|
|
|
The client directory includes NOJSCAP client implementations in multiple languages. Each version takes a challenge string and a difficulty level, then searches for a nonce such that the SHA-256 hash of `challenge + nonce` begins with the required number of leading zero bits.
|
|
|
|
## Implementations
|
|
|
|
- **C**: `nojscap.c`
|
|
- **Go**: `nojscap.go`
|
|
- **Python**: `nojscap.py`
|
|
- **JavaScript (Node.js)**: `nojscap.js`
|
|
- **Rust**: `nojscap.rs`
|
|
|
|
Each implementation provides similar usage and functionality.
|
|
|
|
---
|
|
|
|
## C Version
|
|
|
|
### Compilation
|
|
|
|
You need:
|
|
|
|
- GCC or any C compiler
|
|
- OpenSSL development libraries (`libssl-dev` on Debian-based systems)
|
|
|
|
```sh
|
|
gcc -O2 -o nojscap nojscap.c -lssl -lcrypto
|
|
```
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
./nojscap <challenge_string> <difficulty_bits>
|
|
```
|
|
|
|
- `challenge_string`: Any input string used as the challenge.
|
|
- `difficulty_bits`: Integer between 1 and 256. Higher values are more computationally expensive.
|
|
|
|
### Example
|
|
|
|
```sh
|
|
./nojscap libroot12 26
|
|
Attempts: 0
|
|
Attempts: 1048576
|
|
Attempts: 2097152
|
|
Attempts: 3145728
|
|
Attempts: 4194304
|
|
Attempts: 5242880
|
|
Attempts: 6291456
|
|
Found nonce: 6368109
|
|
Hash: 0000000e724d990815e84e8a53f3f2410875046fe62a050de830d706b853ebe2
|
|
```
|
|
|
|
---
|
|
|
|
## Python
|
|
|
|
```sh
|
|
python3 nojscap.py <challenge_string> <difficulty_bits>
|
|
```
|
|
|
|
May require the `hashlib` module if using older Python verisons (standard in Python 3).
|
|
|
|
## Go
|
|
|
|
```sh
|
|
go run nojscap.go <challenge_string> <difficulty_bits>
|
|
```
|
|
|
|
Requires Go 1.13+.
|
|
|
|
## JavaScript (Node.js)
|
|
|
|
```sh
|
|
node nojscap.js <challenge_string> <difficulty_bits>
|
|
```
|
|
|
|
Uses the built-in `crypto` module.
|
|
|
|
## Rust
|
|
|
|
```sh
|
|
rustc nojscap.rs -o nojscap_rs
|
|
./nojscap_rs <challenge_string> <difficulty_bits>
|
|
```
|
|
|
|
Requires Rust and `sha2` crate if using the `Cargo` version.
|